package gmodel

import (
	"gorm.io/gorm"
)

// fs_coupon 代金券(暂未使用)
type FsCoupon struct {
	Id        int64   `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
	UserId    *int64  `gorm:"default:0;" json:"user_id"`                       // 用户ID 0:暂时未绑定用户
	Sn        *string `gorm:"default:'';" json:"sn"`                           //
	Type      *int64  `gorm:"default:0;" json:"type"`                          // 类型 1:代金券 2:折扣券 3:满减券
	Amount    *int64  `gorm:"default:0;" json:"amount"`                        // 代金券金额、折扣比例、满减金额
	MinAmount *int64  `gorm:"default:0;" json:"min_amount"`                    // 满足条件的最小金额 0:不限制
	MaxAmount *int64  `gorm:"default:0;" json:"max_amount"`                    // 最多优惠的金额 0:不限制
	Stime     *int64  `gorm:"default:0;" json:"stime"`                         // 开始时间 0:立即生效
	Etime     *int64  `gorm:"default:0;" json:"etime"`                         // 结束时间 0:永久有效
	Exclude   *int64  `gorm:"default:2;" json:"exclude"`                       // 是否可以与其他优惠券同时使用 1:可以 2:不可以
	Ctime     *int64  `gorm:"default:0;" json:"ctime"`                         // 添加时间
	GetTime   *int64  `gorm:"default:0;" json:"get_time"`                      // 上架时间
	Status    *int64  `gorm:"default:0;" json:"status"`                        // 状态 是否可用 是否已绑定到订单
}
type FsCouponModel struct {
	db   *gorm.DB
	name string
}

func NewFsCouponModel(db *gorm.DB) *FsCouponModel { return &FsCouponModel{db: db, name: "fs_coupon"} }