package model

import "time"

const (
	FieldPickTimeDaDa                   = "PickTimeDaDa"
	FieldBadComment                     = "BadComment"
	FieldAbsentGoods                    = "AbsentGoods"
	FieldPickTimeDaDaOneWeek            = "PickTimeDaDaOneWeek"
	FieldBadCommentOneWeek              = "BadCommentOneWeek"
	FieldAbsentGoodsOneWeek             = "AbsentGoodsOneWeek"
	FieldStandardFinishTimeSelfDelivery = "StandardFinishTimeSelfDelivery"
	FieldStandardPickUpTimeDaDa         = "StandardPickUpTimeDaDa"

	FieldNoOrderInMonth = "NoOrderInMonth"
	FieldRiskOrderCount = "RiskOrderCount"

	FieldYellowStatus   = "YellowStatus"
	FieldRedStatus      = "RedStatus"
	FieldExtraRedStatus = "ExtraRedStatus"
)

const (
	FlagPickTimeDaDa                   = 1
	FlagBadComment                     = 2
	FlagAbsentGoods                    = 4
	FlagPickTimeDaDaOneWeek            = 8
	FlagBadCommentOneWeek              = 16
	FlagAbsentGoodsOneWeek             = 32
	FlagStandardFinishTimeSelfDelivery = 64
	FlagStandardPickUpTimeDaDa         = 128
	FlagNoOrderInMonth                 = 256
	FlagRiskOrderCount                 = 512
)

type StoreAlert struct {
	ID          int       `orm:"column(id)" json:"id"`
	CreatedTime time.Time `orm:"auto_now_add;type(datetime)" json:"createdTime"`
	AlertDate   time.Time `orm:"auto_now_add;type(datetime)" json:"alertDate"`
	StoreID     int       `orm:"column(store_id)" json:"storeID"`

	PickTimeDaDa                   int `orm:"column(pick_time_order_dada)" json:"pickTimeDaDa"`
	BadComment                     int `orm:"column(bad_comment)" json:"badComment"`
	AbsentGoods                    int `orm:"column(absent_goods)" json:"absentGoods"`
	PickTimeDaDaOneWeek            int `orm:"column(pick_time_dada_oneweek)" json:"pickTimeDaDaOneWeek"`
	BadCommentOneWeek              int `orm:"column(bad_comment_oneweek)" json:"badCommentOneWeek"`
	AbsentGoodsOneWeek             int `orm:"column(absent_goods_oneweek)" json:"absentGoodsOneWeek"`
	StandardFinishTimeSelfDelivery int `orm:"column(standard_finish_time_selfdelivery)" json:"standardFinishTimeSelfDelivery"`
	StandardPickUpTimeDaDa         int `orm:"column(standard_pickup_time_dada)" json:"standardPickUpTimeDaDa"`

	NoOrderInMonth int `json:"noOrderInMonth"`
	RiskOrderCount int `json:"riskOrderCount"`

	YellowStatus   int
	RedStatus      int
	ExtraRedStatus int
}

type StoreAlertEx struct {
	StoreAlert
	StoreName string `orm:"column(store_name)" json:"storeName"`
	CityName  string `orm:"column(city_name)" json:"cityName"`
}

type StoreAlertProperty struct {
	Value string `json:"value"`
	Color string `json:"color"`
}

type StoreAlertAdvanced struct {
	ID          int       `json:"id"`
	CreatedTime time.Time `json:"createdTime"`
	AlertDate   time.Time `json:"alertDate"`
	StoreID     int       `json:"storeID"`
	StoreName   string    `json:"storeName"`
	CityName    string    `json:"cityName"`

	PickTimeDaDa                   StoreAlertProperty
	BadComment                     StoreAlertProperty
	AbsentGoods                    StoreAlertProperty
	PickTimeDaDaOneWeek            StoreAlertProperty
	BadCommentOneWeek              StoreAlertProperty
	AbsentGoodsOneWeek             StoreAlertProperty
	StandardFinishTimeSelfDelivery StoreAlertProperty
	StandardPickUpTimeDaDa         StoreAlertProperty

	NoOrderInMonth StoreAlertProperty
	RiskOrderCount StoreAlertProperty
}

type StoreAlertData struct {
	StoreAlertList []*StoreAlertAdvanced `json:"storeAlertList"`
	TotalCount     int                   `json:"totalCount"`
}

type StoreOrderTime struct {
	StoreID           int       `orm:"column(store_id)"`
	OrderCreateTime   time.Time `orm:"column(order_created_at)"`
	OrderFinishedTime time.Time `orm:"column(order_finished_at)"`
}

type StoreOrderStatus struct {
	StoreID       int       `orm:"column(store_id)"`
	VendorOrderID string    `orm:"column(vendor_order_id)"`
	StatusTime    time.Time `orm:"column(status_time)"`
	Status        int       `orm:"column(status)"`
}

type StoreOrder struct {
	StoreID       int    `orm:"column(store_id)"`
	VendorOrderID string `orm:"column(vendor_order_id)"`
}
