package domain import ( "time" "github.com/gofrs/uuid/v5" ) // Company represents a B2B actor in the marketplace. type Company struct { ID uuid.UUID `db:"id" json:"id"` Role string `db:"role" json:"role"` // pharmacy, distributor, admin CNPJ string `db:"cnpj" json:"cnpj"` CorporateName string `db:"corporate_name" json:"corporate_name"` SanitaryLicense string `db:"sanitary_license" json:"sanitary_license"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` } // Product represents a medicine SKU with batch tracking. type Product struct { ID uuid.UUID `db:"id" json:"id"` SellerID uuid.UUID `db:"seller_id" json:"seller_id"` Name string `db:"name" json:"name"` Description string `db:"description" json:"description"` Batch string `db:"batch" json:"batch"` ExpiresAt time.Time `db:"expires_at" json:"expires_at"` PriceCents int64 `db:"price_cents" json:"price_cents"` Stock int64 `db:"stock" json:"stock"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` } // Order captures the status lifecycle and payment intent. type Order struct { ID uuid.UUID `db:"id" json:"id"` BuyerID uuid.UUID `db:"buyer_id" json:"buyer_id"` SellerID uuid.UUID `db:"seller_id" json:"seller_id"` Status OrderStatus `db:"status" json:"status"` TotalCents int64 `db:"total_cents" json:"total_cents"` Items []OrderItem `json:"items"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` } // OrderItem stores SKU-level batch tracking. type OrderItem struct { ID uuid.UUID `db:"id" json:"id"` OrderID uuid.UUID `db:"order_id" json:"order_id"` ProductID uuid.UUID `db:"product_id" json:"product_id"` Quantity int64 `db:"quantity" json:"quantity"` UnitCents int64 `db:"unit_cents" json:"unit_cents"` Batch string `db:"batch" json:"batch"` ExpiresAt time.Time `db:"expires_at" json:"expires_at"` } // PaymentPreference wraps the data needed for Mercado Pago split payments. type PaymentPreference struct { OrderID uuid.UUID `json:"order_id"` Gateway string `json:"gateway"` CommissionPct float64 `json:"commission_pct"` MarketplaceFee int64 `json:"marketplace_fee"` SellerReceivable int64 `json:"seller_receivable"` PaymentURL string `json:"payment_url"` } // OrderStatus enumerates supported transitions. type OrderStatus string const ( OrderStatusPending OrderStatus = "Pendente" OrderStatusPaid OrderStatus = "Pago" OrderStatusInvoiced OrderStatus = "Faturado" OrderStatusDelivered OrderStatus = "Entregue" )