package schema

import (
	"github.guxuan/haibei/pkg/util"
	"time"
)

// Defining the `SmsLog` struct.
type SMSLog struct {
	util.BaseModel
	CustomerName string    `json:"customerName" gorm:"index;comment:客户姓名"`  //客户姓名
	Phone        string    `json:"phone" gorm:"size:20;index;comment:手机号"`  //手机号
	SMSContent   string    `json:"SMSContent" gorm:"size:128;comment:短信内容"` //短信内容
	SMSType      string    `json:"smsType" gorm:"size:20;comment:短信类型"`     ///短信类型
	SendAt       time.Time `json:"sendAt" gorm:"size:32;comment:发送时间"`      //发送时间
}

// Defining the query parameters for the `SmsLog` struct.
type SMSLogQueryParam struct {
	util.PaginationParam
	CustomerName string `form:"customerName"` //客户姓名
	Phone        string `form:"phone"`        //手机号
	SMSType      string `form:"smsType"`      ///短信类型
}

// Defining the query options for the `SmsLog` struct.
type SMSLogQueryOptions struct {
	util.QueryOptions
}

// Defining the query result for the `SmsLog` struct.
type SMSLogQueryResult struct {
	Data       SMSLogs
	PageResult *util.PaginationResult
}

// Defining the slice of `SmsLog` struct.
type SMSLogs []*SMSLog

// Defining the data structure for creating a `SmsLog` struct.
type SMSLogForm struct {
	CustomerName string    `json:"customerName"` //客户姓名
	Phone        string    `json:"phone"`        //手机号
	SMSContent   string    `json:"SMSContent"`   //短信内容
	SMSType      string    `json:"smsType"`      ///短信类型
	SendAt       time.Time `json:"sendAt"`       //发送时间
}

// A validation function for the `SmsLogForm` struct.
func (a *SMSLogForm) Validate() error {
	return nil
}

// Convert `SmsLogForm` to `SmsLog` object.
func (a *SMSLogForm) FillTo(smsLog *SMSLog) error {
	smsLog.CustomerName = a.CustomerName
	smsLog.Phone = a.Phone
	smsLog.SMSContent = a.SMSContent
	smsLog.SMSType = a.SMSType
	smsLog.SendAt = a.SendAt
	return nil
}
