package model

import (
	"time"

	"gorm.io/datatypes"
)

const TableNameDouyinProductRewards = "douyin_product_rewards"

// DouyinProductRewards 抖店商品奖励规则表
type DouyinProductRewards struct {
	ID            int64          `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
	ProductID     string         `gorm:"column:product_id;not null;uniqueIndex:uk_product_id;comment:抖店商品ID" json:"product_id"`
	ProductName   string         `gorm:"column:product_name;not null;default:'';comment:商品名称" json:"product_name"`
	RewardType    string         `gorm:"column:reward_type;not null;comment:奖励类型" json:"reward_type"`
	RewardPayload datatypes.JSON `gorm:"column:reward_payload;comment:奖励参数JSON" json:"reward_payload"`
	Quantity      int32          `gorm:"column:quantity;not null;default:1;comment:发放数量" json:"quantity"`
	Status        int32          `gorm:"column:status;not null;default:1;comment:状态: 1=启用 0=禁用" json:"status"`
	CreatedAt     time.Time      `gorm:"column:created_at;default:CURRENT_TIMESTAMP(3)" json:"created_at"`
	UpdatedAt     time.Time      `gorm:"column:updated_at;default:CURRENT_TIMESTAMP(3)" json:"updated_at"`
}

func (*DouyinProductRewards) TableName() string {
	return TableNameDouyinProductRewards
}
