package training import ( "github.com/shopspring/decimal" "gitlab.mareshq.com/hq/backoffice/backoffice-api/internal/currency" ) type ID = int type Training struct { id ID // unique and auto-incrementing published bool retired bool days int8 // In the future, this should be localized name string pricing []Price `db:"-"` } type Price struct { Amount decimal.Decimal Currency currency.Currency Type PriceType } type PriceType string const ( OpenTrainingPriceType PriceType = "OPEN" CorporateTrainingPriceType PriceType = "CORPORATE" ) func NewTraining(name string, days int8, pricing []Price) *Training { t := &Training{ // metadata published: false, retired: false, // data name: name, days: days, pricing: make([]Price, 0), } if pricing != nil { t.pricing = pricing } return t } func (t *Training) ID() ID { return t.id } func (t *Training) Days() int8 { return t.days } func (t *Training) Published() bool { return t.published } func (t *Training) Retired() bool { return t.retired } func (t *Training) Name() string { return t.name } func (t *Training) Pricing() []Price { return t.pricing }