package models

import "time"

type AstrologerProduct struct {
	ID uint `gorm:"primaryKey;autoIncrement" json:"id"`

	ProductID uint `gorm:"column:productId;not null;index" json:"productId"`

	AstrologerID uint `gorm:"column:astrologerId;not null;index" json:"astrologerId"`

	ProductPrice *float64 `gorm:"column:productPrice;type:decimal(10,2)" json:"productPrice,omitempty"`

	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,omitempty"`

	UpdatedAt *time.Time `gorm:"column:updated_at" json:"updated_at,omitempty"`

	CreatedBy *int `gorm:"column:createdBy" json:"createdBy,omitempty"`

	ModifiedBy *int `gorm:"column:modifiedBy" json:"modifiedBy,omitempty"`

	// Relations
	Product    AstromallProduct `gorm:"foreignKey:ProductID;references:ID" json:"product,omitempty"`

	Astrologer User `gorm:"foreignKey:AstrologerID;references:ID" json:"astrologer,omitempty"`
}

func (AstrologerProduct) TableName() string {
	return "astrologer_product"
}