package models

type Product struct {
	BaseModel

	Name              string  `gorm:"type:varchar(255);not null" json:"name"`
	Features          string  `gorm:"type:text" json:"features"`
	ProductImage      string  `gorm:"type:varchar(500)" json:"productImage"`
	ProductCategoryID uint    `gorm:"column:productCategoryId;index" json:"productCategoryId"`
	Amount            float64 `gorm:"type:decimal(10,2);default:0" json:"amount"`
	Description       string  `gorm:"type:text" json:"description"`

	CreatedBy  uint `gorm:"column:createdBy" json:"createdBy"`
	ModifiedBy uint `gorm:"column:modifiedBy" json:"modifiedBy"`

	Category ProductCategory `gorm:"foreignKey:ProductCategoryID;references:ID" json:"category,omitempty"`
}

func (Product) TableName() string {
	return "astromall_products"
}