db/specs/modelsold/biz/product.v

45 lines
1.3 KiB
V

module biz
import base
import freeflowuniverse.herolib.data.ourtime
import freeflowuniverse.herolib.data.currency
// import freeflowuniverse.herolib.core.texttools { name_fix }
// ProductType represents the type of a product
pub enum ProductType {
product
service
}
// ProductStatus represents the status of a product
pub enum ProductStatus {
available
unavailable
}
// ProductComponent represents a component or sub-part of a product.
// Its lifecycle is tied to the parent Product and it does not have its own independent ID.
pub struct ProductComponent {
pub mut:
name string
description string
quantity int
}
// Product represents a product or service offered
pub struct Product {
base.Base // Provides id u32, creation_time, mod_time, comments []u32
pub mut:
name string
description string
price currency.Currency
type_ ProductType
category string
status ProductStatus
max_amount u16 // Maximum available quantity of this product, if applicable
purchase_till ourtime.OurTime // Date until which this product can be purchased
active_till ourtime.OurTime // Date until which this product/service remains active (e.g., for subscriptions)
components []ProductComponent // List of components that make up this product
}