50 lines
1.2 KiB
V
50 lines
1.2 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 of a product
|
|
pub struct ProductComponent {
|
|
pub mut:
|
|
id u32
|
|
name string
|
|
description string
|
|
quantity int
|
|
created_at ourtime.OurTime
|
|
updated_at ourtime.OurTime
|
|
}
|
|
|
|
// Product represents a product or service offered by the Freezone
|
|
pub struct Product {
|
|
base.Base // Base struct for common fields
|
|
pub mut:
|
|
id u32
|
|
name string
|
|
description string
|
|
price currency.Currency
|
|
type_ ProductType
|
|
category string
|
|
status ProductStatus
|
|
created_at ourtime.OurTime
|
|
updated_at ourtime.OurTime
|
|
max_amount u16 // means allows us to define how many max of this there are
|
|
purchase_till ourtime.OurTime
|
|
active_till ourtime.OurTime // after this product no longer active if e.g. a service
|
|
components []ProductComponent
|
|
}
|