package model

import "time"

const (
	FieldStoreOpenTime     = "StoreOpenTime"
	FieldSaleSkuCount      = "SaleSkuCount"
	FieldAveragePickupTime = "AveragePickupTime"
	FieldBadCommentOrder   = "BadCommentOrder"
	FieldUnfinishOrder     = "UnfinishOrder"
	FieldAbsentGoodsOrder  = "AbsentGoodsOrder"
	FieldPromotionSku      = "PromotionSku"
	FieldFullVendor        = "FullVendor"
	FieldStoreRange        = "StoreRange"
	FieldSaleSkuPrice      = "SaleSkuPrice"

	FieldTotalScore = "TotalScore"
)

type StoreScore struct {
	ID        int       `orm:"column(id)" json:"id"`
	CreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`
	ScoreDate time.Time `orm:"auto_now_add;type(datetime)" json:"scoreDate"`
	StoreID   int       `orm:"column(store_id)" json:"storeID"`

	StoreOpenTime     int `orm:"column(store_open_time)" json:"storeOpenTime"`
	SaleSkuCount      int `orm:"column(sale_sku_count)" json:"saleSkuCount"`
	AveragePickupTime int `orm:"column(average_pickup_time)" json:"averagePickupTime"`
	BadCommentOrder   int `orm:"column(bad_comment_order)" json:"badCommentOrder"`
	UnfinishOrder     int `orm:"column(unfinish_order)" json:"unfinishOrder"`
	AbsentGoodsOrder  int `orm:"column(absent_Goods_order)" json:"absentGoodsOrder"`
	PromotionSku      int `orm:"column(promotion_sku)" json:"promotionSku"`
	FullVendor        int `orm:"column(full_vendor)" json:"fullVendor"`
	StoreRange        int `orm:"column(store_range)" json:"storeRange"`
	SaleSkuPrice      int `orm:"column(sale_sku_price)" json:"saleSkuPrice"`
}

func (*StoreScore) TableIndex() [][]string {
	return [][]string{
		[]string{"StoreID"},
	}
}

type StoreScoreEx struct {
	StoreScore
	StoreName string `json:"storeName"`
}

type WeeklyStoreScore struct {
	StoreScoreEx
	BeginTime      time.Time `json:"beginTime"`
	EndTime        time.Time `json:"endTime"`
	TotalScore     int       `json:"totalScore"`
	ItemTotalScore int       `json:"itemTotalScore"`
	Level          int       `json:"level"`
}

type StoreTotalScore struct {
	StoreID    int    `orm:"column(store_id)" json:"storeID"`
	StoreName  string `orm:"column(store_name)" json:"storeName"`
	StoreScore int    `orm:"column(store_score)" json:"storeScore"`
	CityName   string `orm:"column(city_name)" json:"cityName"`
}

type StoreTotalScoreEx struct {
	StoreTotalScoreList []*StoreTotalScore `json:"storeTotalScoreList"`
	TotalCount          int                `json:"totalCount"`
}

type StoreCount struct {
	StoreID int `orm:"column(store_id)"`
	Count   int
}

type OrderPickupTime struct {
	StatusTime   time.Time
	PickDeadline time.Time
}

type StoreFine struct {
	ID           int       `orm:"column(id)" json:"id"`
	CreatedAt    time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`        // 数据时间
	StoreID      int       `orm:"column(store_id);size(16)" json:"storeID"`            // 门店ID
	VendorID     int       `orm:"column(vendor_id);size(4)" json:"vendor_id"`          // 平台ID
	SettleAmount int64     `orm:"column(settle_amount);size(16)" json:"settle_amount"` // 罚没金额
	BillType     int       `orm:"column(bill_type);size(16)" json:"bill_type"`         // 罚没类型
	BillDesc     string    `orm:"column(bill_desc);size(64)" json:"bill_desc"`         // 罚没描述
	BillId       string    `orm:"column(bill_id);size(32)" json:"bill_id"`             // 数据ID
	FinishTime   time.Time `orm:"column(finish_time);size(32)" json:"finish_time"`     // 归账日期
}

func (*StoreScore) StoreFine() [][]string {
	return [][]string{
		[]string{"StoreID"},
	}
}
