package models

import "time"

type ProductCategory struct {
	ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
	Name string `gorm:"column:name;type:varchar(255);not null" json:"name"`
	DisplayOrder *int `gorm:"column:displayOrder" json:"displayOrder"`
	CategoryImage string `gorm:"column:categoryImage;type:varchar(255);not null" json:"categoryImage"`
	IsActive bool `gorm:"column:isActive;default:true" json:"isActive"`
	IsDelete bool `gorm:"column:isDelete;default:false" json:"isDelete"`
	CreatedAt *time.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt *time.Time `gorm:"column:updated_at" json:"updated_at"`
	CreatedBy int `gorm:"column:createdBy;not null" json:"createdBy"`
	ModifiedBy int `gorm:"column:modifiedBy;not null" json:"modifiedBy"`
	// Relationship
	Products []AstromallProduct `gorm:"foreignKey:ProductCategoryID;references:ID" json:"products"`
}

func (ProductCategory) TableName() string {
	return "product_categories"
}