package v1

import (
	"kami/api/commonApi"
	"kami/internal/model/entity"

	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gtime"
)

type StealStatusSetReq struct {
	g.Meta `path:"/merchant/config/stealRule/status" tags:"偷卡设置" method:"post" summary:"设置偷卡状态"`
	Status bool `json:"status" description:"状态ID"`
}

type StealStatusSetRes struct {
	g.Meta `mime:"application/json"`
}

type StealStatusGetReq struct {
	g.Meta `path:"/merchant/config/stealRule/status" tags:"偷卡设置" method:"get" summary:"获取偷卡状态"`
}

type StealStatusGetRes struct {
	Status bool `json:"stealStatus" description:"状态"`
}

type MerchantHiddenConfig struct {
	Name             string `json:"name" v:"required#名称不能为空" description:"名称"`
	MerchantUid      string `json:"merchantUid" v:"required#商户id不能为空" description:"商户id"`
	RoadUid          string `json:"roadUid" v:"required#通道id不能为空" description:"通道id"`
	ExtraReturnInfo  string `json:"extraReturnInfo" description:"返回信息"`
	Amount           int    `json:"amount" v:"required#偷卡金额间隔不能为空" description:"偷卡金额间隔"`
	FaceAmount       int    `json:"faceAmount" v:"required#偷卡面额不能为空" description:"偷卡面额"`
	DelayDurationMin int    `json:"delayDurationMin" v:"required#最小延迟时间不能为空" description:"延迟时间"`
	DelayDurationMax int    `json:"delayDurationMax" v:"required#最大延迟时间不能为空" description:"延迟时间"`
	Enable           int    `json:"enable" v:"required#启用状态不能为空" description:"启用状态"`
	Strategy         int    `json:"strategy" v:"required#偷卡策略不能为空" description:"偷卡策略"`
	AmountRule       []int  `json:"amountRule" v:"required#金额规则不能为空" description:"金额规则"`
}

type StealCreateReq struct {
	g.Meta `path:"/merchant/config/stealRule/create" tags:"偷卡设置" method:"post" summary:"添加一条规则"`
	*MerchantHiddenConfig
}

type StealCreateRes struct {
}

type StealUpdateReq struct {
	g.Meta `path:"/merchant/config/stealRule/update" tags:"偷卡设置" method:"post" summary:"更新一条规则"`
	commonApi.CommonIntId
	*MerchantHiddenConfig
}

type StealUpdateRes struct {
}

type StealUpdateStatusReq struct {
	g.Meta `path:"/merchant/config/stealRule/updateStatus" tags:"偷卡设置" method:"post" summary:"更新一条规则"`
	commonApi.CommonIntId
	Enable int `json:"enable" v:"required#启用状态不能为空" description:"启用状态"`
}

type StealUpdateStatusRes struct {
}

type StealDeleteReq struct {
	g.Meta `path:"/merchant/config/stealRule/update" tags:"偷卡设置" method:"delete" summary:"删除一条规则"`
	commonApi.CommonIntId
}

type StealDeleteRes struct {
}

type StealListReq struct {
	g.Meta `path:"/merchant/config/stealRule/list" tags:"偷卡设置" method:"get" summary:"获取列表"`
	commonApi.CommonPageReq
}

type MerchantHiddenConfigEntity struct {
	entity.V1MerchantHiddenConfig
	AmountRule []int `json:"amountRule" orm:"amount_rule"`
}

type StealListRes struct {
	commonApi.CommonPageRes[*MerchantHiddenConfigEntity]
}

type StealRecordListReq struct {
	g.Meta `path:"/merchant/config/stealRule/record" tags:"偷卡设置" method:"get" summary:"获取偷卡记录"`
	commonApi.CommonPageReq
}

type StealRecordListRes struct {
	commonApi.CommonPageRes[*entity.V1MerchantHiddenRecord]
}

type StealStatsReq struct {
	g.Meta `path:"/merchant/config/stealRule/stats" tags:"偷卡设置" method:"get" summary:"获取偷卡统计"`
	commonApi.CommonPageReq
	DateRange []*gtime.Time `json:"dateRange"`
}

type StealStatsEntity struct {
	MerchantUid  string `json:"merchantUid" orm:"merchant_uid"`
	TotalAmount  int    `json:"totalAmount" orm:"total_amount"`
	TotalCount   int    `json:"totalCount" orm:"total_count"`
	ActualAmount int    `json:"actualAmount" orm:"actual_amount"`
	ActualCount  int    `json:"actualCount" orm:"actual_count"`
	Date         string `json:"date" orm:"date"`
}

type StealStatsRes struct {
	commonApi.CommonPageRes[*StealStatsEntity]
}
