package model

type CustomerCart struct {
	CartID   uint          `gorm:"column:cart_id;primaryKey;autoIncrement" json:"cart_id"`
	UserID   uint          `gorm:"column:user_id;not null;index" json:"-"`
	Name     *string       `gorm:"column:name;size:255" json:"name,omitempty"`
	Products []CartProduct `gorm:"foreignKey:CartID;references:CartID" json:"products,omitempty"`
}

func (CustomerCart) TableName() string {
	return "b2b_customer_carts"
}

type CartProduct struct {
	ID                 uint  `gorm:"column:id;primaryKey;autoIncrement" json:"-"`
	CartID             uint  `gorm:"column:cart_id;not null;index" json:"-"`
	ProductID          uint  `gorm:"column:product_id;not null" json:"product_id"`
	ProductAttributeID *uint `gorm:"column:product_attribute_id" json:"product_attribute_id,omitempty"`
	Amount             uint  `gorm:"column:amount;not null" json:"amount"`
}

func (CartProduct) TableName() string {
	return "b2b_carts_products"
}
