tane/apps/app_seeds/lib/db/enums.dart
vjrj 3954c62aa6 feat(db): lot presentation + attachment sort order (schema v4→v5)
Expand LotType from {seed, plant} to six append-only forms (seed,
seedling, plant, tree, bulb, cutting) and add an optional Presentation
attribute (pot/tray/plug/bareRoot/rootBall) kept separate from quantity
so 'how many' and 'in what packaging' never conflate.

Add attachments.sortOrder so the cover photo is the lowest-ordered one,
enabling reordering from the full-screen viewer. Expand QuantityKind
with the new plant-aware forms.

Migrations are additive (v1→v5 all covered by migration_test); enum
values are stored by name and appended only, keeping CRDT sync safe.
2026-07-09 11:51:21 +02:00

48 lines
2 KiB
Dart

// Domain enums stored by **name** (never by index) via Drift `textEnum`, so
// the stored keys are stable across migrations. Per data-model §5.2, values
// may only be appended, never renumbered or reused; when sync arrives, readers
// must tolerate unknown values (map to a safe default). No sync yet in Block 1.
/// The form in which a lot is held. `seed` is dry seed (the only form
/// germination tests apply to); the rest are living/vegetative material. Values
/// are stored by name and append-only (data-model §5): never renamed/reordered.
///
/// - `seedling` — a young plant grown from seed, to transplant (plantón).
/// - `plant` — an established plant (potted or bare-root).
/// - `tree` — a woody plant: tree or shrub.
/// - `bulb` — a storage organ: bulb, corm, tuber or rhizome.
/// - `cutting` — vegetative propagation material (cutting, scion).
enum LotType { seed, plant, seedling, tree, bulb, cutting }
/// How living plant material is packaged/supplied — an optional attribute of a
/// non-seed [Lot], kept separate from the amount. Append-only by name.
///
/// - `pot` — in a pot/container (maceta/contenedor).
/// - `tray` — in a plug/cell tray (bandeja de alvéolos).
/// - `plug` — a single plug/cell.
/// - `bareRoot` — dormant, roots exposed, no soil (raíz desnuda).
/// - `rootBall` — dug with an intact soil ball (cepellón).
enum Presentation { pot, tray, plug, bareRoot, rootBall }
/// Per-lot visibility (data-model §2.3). Used by the future sharing layer.
enum OfferStatus { private, shared, exchange, sell }
/// Append-only event kinds on a Lot (data-model §2.4).
enum MovementType {
received,
given,
sown,
harvested,
germinationTest,
split,
discarded,
}
/// A counterparty is a person or a collective (data-model §2.5).
enum PartyKind { person, collective }
/// Attachment media kind (data-model §2.1).
enum AttachmentKind { photo, doc }
/// Polymorphic parent of an Attachment / ExternalLink.
enum ParentType { variety, lot, movement }