package model

const (
	MessageTypeStore    = 1
	MessageTypeUser     = 2
	MessageTypeStoreAct = 3
)

const (
	MessageStatusNew            = 0
	MessageStatusSendAllSuccess = 1
	MessageStatusSendSuccess    = 2
	MessageStatusSendAllFailed  = 3
)

var (
	StoreMsgSendStatusName = map[int]string{
		MessageStatusNew:            "发送中",
		MessageStatusSendAllSuccess: "成功",
		MessageStatusSendSuccess:    "部分成功",
		MessageStatusSendAllFailed:  "失败",
	}
)

type Message struct {
	ModelIDCULD
	Type    int8   `json:"type"` //1发给门店，2发给用户，3发给门店的统计活动参与信息
	Title   string `json:"title"`
	Content string `orm:"type(text)" json:"content"`
	ActInfo string `json:"actInfo"` //活动信息，时间平台等
	Imgs    string `json:"imgs"`    //图片集合
}

func (*Message) TableIndex() [][]string {
	return [][]string{
		[]string{"CreatedAt"},
		[]string{"DeletedAt"},
	}
}

type MessageStatus struct {
	ModelIDCULD
	MessageID     int    `orm:"column(message_id)" json:"messageID"`
	StoreID       int    `orm:"column(store_id)" json:"storeID"`
	Status        int8   `json:"status"`
	ReadCount     int    `json:"readCount"`
	UserID        string `orm:"column(user_id)" json:"userID"`
	ConfirmStatus int    `json:"confirmStatus"` //商家确认活动，默认0不确认，1确认
}

func (*MessageStatus) TableIndex() [][]string {
	return [][]string{
		[]string{"MessageID", "Status"},
		[]string{"StoreID", "MessageID", "Status"},
	}
}

type MessageActInfo struct {
	VendorID int    `orm:"colmun(vendor_id)" json:"vendorID"`
	BeginAt  string `json:"beginAt"`
	EndAt    string `json:"endAt"`
}

type ImMessageRecord struct {
	ModelIDCULD
	UserID        string `orm:"size(48);column(user_id)" json:"userID"`       //消息发送方userID
	ReceiveID     string `orm:"size(48);column(receive_id)" json:"receiveID"` //接收方ID，可以是userID，也可以是群ID
	Name          string `json:"name"`
	Content       string `orm:"type(text)" json:"content"` //消息内容
	MessageType   int    `json:"messageType"`              //消息类型，文字，图片
	StoreID       int    `orm:"column(store_id)" json:"storeID"`
	VendorID      int    `orm:"column(vendor_id)" json:"vendorID"`
	VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
}

func (*ImMessageRecord) TableIndex() [][]string {
	return [][]string{
		[]string{"UserID"},
		[]string{"ReceiveID"},
		[]string{"StoreID"},
		[]string{"VendorID"},
		[]string{"VendorOrderID"},
	}
}

type KnowledgeDepot struct {
	ModelIDCULD

	Title   string `json:"title"`                    //标题
	Content string `orm:"type(text)" json:"content"` //每条知识的内容
	IsCheck int    `json:"isCheck"`                  //是否勾选
}

type DepotMedia struct {
	ModelIDCULD
}
