package v1

import (
	"kami/api/commonApi"
	v1 "kami/api/sysUser/v1"
	"kami/internal/consts"
	"kami/internal/model/entity"

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

type AccountDeleteReq struct {
	g.Meta `path:"/cardInfo/walmart/account/delete" tags:"沃尔玛充值卡账户" method:"delete" summary:"删除沃尔玛充值卡"`
	commonApi.CommonStrId
}

type AccountDeleteRes struct{}

type AccountListReq struct {
	g.Meta `path:"/cardInfo/walmart/account/getList" tags:"沃尔玛充值卡账户" method:"get" summary:"获取沃尔玛充值卡列表"`
	commonApi.CommonPageReq
	Name            string `json:"name" description:"账户名称"`
	NickName        string `json:"nickName" description:"用户昵称"`
	Cookie          string `json:"cookie" description:"cookie"`
	CreatedUserName string `json:"CreatedUserName" description:"创建用户昵称"`
	GroupId         int64  `json:"groupId" description:"分组ID"`
	UserId          string `json:"userId" description:"用户ID"`
}

type AccountListRecord struct {
	entity.V1CardRedeemAccountInfo
	UploadUser struct {
		Id       string `json:"id"`
		Username string `json:"username"`
		Nickname string `json:"nickname"`
	} `json:"uploadUser"`
}

type AccountListRes struct {
	commonApi.CommonPageRes[AccountListRecord]
}

type AccountRecord struct {
	Cookie         string `json:"cookie" v:"required#状态不能为空" description:"cookie不能为空"`
	Name           string `json:"name" description:"别名"`
	GroupId        int    `json:"groupId" description:"分组ID"`
	MaxAmountLimit int    `json:"maxAmountLimit" description:"最大充值限制" v:"required#最大充值金额不能为空"`
	MaxCountLimit  int    `json:"maxCountLimit" description:"最大充值次数" v:"required#最大充值次数不能为空"`
	Status         int    `json:"status" description:"状态"`
	Remark         string `json:"remark" description:"备注"`
}

type AccountCookieCheckReq struct {
	g.Meta `path:"/cardInfo/walmart/account/checkCookie" tags:"沃尔玛充值卡账户" method:"post" summary:"检测cookie是否可用"`
	Cookie string `json:"cookie" v:"required#cookie不能为空" description:"cookie"`
}

type AccountLoadReq struct {
	g.Meta    `path:"/cardInfo/walmart/account/load" tags:"沃尔玛充值卡账户" method:"post" summary:"导入沃尔玛账户"`
	Cookie    string `json:"cookie" v:"required#状态不能为空" description:"cookie不能为空"`
	UserId    string `json:"id" description:""  v:"required#用户id不能为空"`
	Name      string `json:"name" description:"别名" v:"required#名称不能为空"`
	GroupName string `json:"groupName" description:"分组名称" v:"required#分组名称不能为空"`
	Remark    string `json:"remark" description:"备注"`
}

type AccountLoadRes struct {
}

type AccountCookieCheckRes struct {
	Username    string  `json:"username" dc:"用户名"`
	Nickname    string  `json:"nickname" dc:"昵称"`
	Balance     float64 `json:"balance" dc:"余额"`
	IsExist     bool    `json:"isExist" dc:"是否存在系统中"`
	IsAvailable bool    `json:"isAvailable" dc:"是否可用"`
}

type AccountCreateReq struct {
	g.Meta `path:"/cardInfo/walmart/account/create" tags:"沃尔玛充值卡账户" method:"post" summary:"创建沃尔玛账户"`
	AccountRecord
}

type AccountCreateRes struct{}

type AccountUpdateReq struct {
	g.Meta `path:"/cardInfo/walmart/account/update" tags:"沃尔玛充值卡账户" method:"put" summary:"修改沃尔玛账户"`
	commonApi.CommonStrId
	AccountRecord
}

type AccountUpdateRes struct {
}

type AccountWalletListReq struct {
	g.Meta `path:"/cardInfo/walmart/account/getWalletList" tags:"沃尔玛充值卡账户" method:"get" summary:"获取沃尔玛账户流水"`
	commonApi.CommonPageReq
	AccountId string `json:"accountId" v:"required#缺失ID"`
}

type AccountWalletListRes struct {
	commonApi.CommonPageRes[*entity.V1CardRedeemAccountHistory]
}

type AccountUpdateStatusReq struct {
	g.Meta `path:"/cardInfo/walmart/account/updateStatus" tags:"沃尔玛充值卡账户" method:"put" summary:"修改沃尔玛账户状态"`
	commonApi.CommonStrId
	Status consts.RedeemAccountStatus `json:"status" v:"required#状态不能为空" description:"状态"`
}

type AccountUpdateStatusRes struct {
}

type AccountRefreshStatusReq struct {
	g.Meta `path:"/cardInfo/walmart/account/refreshStatus" tags:"沃尔玛充值卡账户" method:"put" summary:"刷新账号充值状态"`
	commonApi.CommonStrId
}

type AccountRefreshStatusRes struct {
}

type DownloadTemplateReq struct {
	g.Meta `path:"/cardInfo/walmart/account/downloadTemplate" tags:"沃尔玛充值卡账户" method:"get" summary:"下载导入模板"`
}

type DownloadTemplateRes struct {
	g.Meta `mime:"application/vnd.ms-excel"`
}

type AccountCookieBatchCheckReq struct {
	g.Meta `path:"/cardInfo/walmart/account/check" tags:"沃尔玛充值卡账户" method:"post" summary:"检查上传礼品卡是否正常"`
	File   *ghttp.UploadFile `v:"required#文件不能为空" json:"file" type:"file" description:"选择上传文件"`
}

type AccountCookieBatchInfo struct {
	AccountCookieCheckRes
	Name           string `json:"name" dc:"别名"`
	Cookie         string `json:"cookie" dc:"cookie"`
	MaxAmountLimit int    `json:"maxAmountLimit" description:"最大充值限制"`
	MaxCountLimit  int    `json:"maxCountLimit" description:"最大充值次数"`
}

type AccountCookieBatchCheckRes struct {
	Msg  string                    `json:"msg" description:"导入结果"`
	List []*AccountCookieBatchInfo `json:"list" description:"导入结果"`
}

type AccountCookieBatchAddReq struct {
	g.Meta `path:"/cardInfo/walmart/account/batchAdd" tags:"沃尔玛充值卡账户" method:"post" summary:"检查礼品卡是否正常"`
	List   []*AccountCookieBatchInfo `json:"list" description:"导入结果"`
}

type AccountCookieBatchAddRes struct {
}

type DownloadReq struct {
	g.Meta          `path:"/cardInfo/walmart/account/download" tags:"沃尔玛充值卡账户" method:"get" summary:"下载充值账户"`
	UserId          string `json:"userId" description:"用户ID"`
	Name            string `json:"name" description:"账户名称"`
	NickName        string `json:"nickName" description:"用户昵称"`
	Cookie          string `json:"cookie"`
	CreatedUserName string `json:"CreatedUserName" description:"创建用户昵称"`
	GroupId         int64  `json:"groupId" description:"分组ID"`
}

type DownloadRes struct {
	g.Meta `mime:"application/vnd.ms-excel"`
}

type AccountDailySummaryReq struct {
	g.Meta `path:"/cardInfo/walmart/account/dailySummary" tags:"沃尔玛充值卡账户" method:"get" summary:"每日汇总"`
	commonApi.CommonPageReq
	Username    string      `json:"username" description:"用户"`
	AccountName string      `json:"accountName" description:"账户名称"`
	Date        *gtime.Time `json:"date" description:"日期"`
	UserId      string      `json:"userId" description:"用户ID"`
}

type CardRedeemAccountSummary struct {
	GroupId          int          `json:"groupId"          orm:"group_id"           description:""`
	GroupName        string       `json:"groupName"        orm:"group_name"         description:""`
	AccountInfo      *AccountInfo `json:"accountInfo"`
	Id               int          `json:"id"               orm:"id"                 description:""`
	AccountId        string       `json:"accountId"        orm:"account_id"         description:""`
	AmountTotalSum   float64      `json:"amountTotalSum"   orm:"amount_total_sum"   description:""`
	AmountTodaySum   float64      `json:"amountTodaySum"   orm:"amount_today_sum"   description:""`
	AmountTotalCount int          `json:"amountTotalCount" orm:"amount_total_count" description:""`
	AmountTodayCount int          `json:"amountTodayCount" orm:"amount_today_count" description:""`
	Date             *gtime.Time  `json:"date"             orm:"date"               description:""`
	CreatedAt        *gtime.Time  `json:"createdAt"        orm:"created_at"        description:""`
	UpdatedAt        *gtime.Time  `json:"updatedAt"        orm:"updated_at"        description:""`
	DeletedAt        *gtime.Time  `json:"deletedAt"        orm:"deleted_at"        description:""`
}

type AccountInfo struct {
	g.Meta           `orm:"table:card_redeem_account_info"`
	GroupId          int              `json:"groupId"          orm:"group_id"           description:""`
	UploadUser       v1.SysUserRecord `json:"uploadUser"   orm:"with:id=create_user_id"`
	CreateUserId     string           `json:"createUserId"     orm:"create_user_id"     description:"创建人"`
	Balance          float64          `json:"balance"          orm:"balance"            description:"余额"`
	Status           int              `json:"status"           orm:"status"             description:"状态 1.正常 0.禁用"`
	MaxCountLimit    int              `json:"maxCountLimit"    orm:"max_count_limit"    description:"账号最大充值次数"`
	MaxAmountLimit   int              `json:"maxAmountLimit"   orm:"max_amount_limit"   description:"最大充值限制"`
	AmountTodayCount int              `json:"amountTodayCount" orm:"amount_today_count" description:""`
	Id               string           `json:"id"               orm:"id"                 description:""`
	Name             string           `json:"name"             orm:"name"               description:""`
	Category         string           `json:"category"         orm:"category"           description:"账户类型"`
	AmountTotalSum   float64          `json:"amountTotalSum"   orm:"amount_total_sum"   description:"账单所有统计金额"`
	AmountTodaySum   float64          `json:"amountTodaySum"   orm:"amount_today_sum"   description:"账单今日统计金额"`
	EffectiveBalance float64          `json:"effectiveBalance" orm:"effective_balance"  description:"有效充值余额"`
	AmountTotalCount int              `json:"amountTotalCount" orm:"amount_total_count" description:""`
	CreatedAt        *gtime.Time      `json:"createdAt"        orm:"created_at"        description:""`
	UpdatedAt        *gtime.Time      `json:"updatedAt"        orm:"updated_at"        description:""`
	DeletedAt        *gtime.Time      `json:"deletedAt"        orm:"deleted_at"        description:""`
}

type AccountDailySummaryRes struct {
	commonApi.CommonPageRes[*CardRedeemAccountSummary]
}

type AccountSummaryDownloadReq struct {
	g.Meta `path:"/cardInfo/walmart/account/summaryDownload" tags:"沃尔玛充值卡账户" method:"get" summary:"下载充值账户"`
	commonApi.CommonPageReq
	GroupId     int64       `json:"groupId"`
	Username    string      `json:"username" description:"用户"`
	AccountName string      `json:"accountName" description:"账户名称"`
	Date        *gtime.Time `json:"date" description:"日期"`
}

type AccountSummaryDownloadRes struct {
	g.Meta `mime:"application/vnd.ms-excel"`
}

type AccountStatusDetectReq struct {
	g.Meta `path:"/cardInfo/walmart/account/statusDetect" tags:"沃尔玛充值卡账户" method:"get" summary:"检测账户状态"`
	commonApi.CommonStrId
}

type AccountStatusDetectRes struct {
	Status bool `json:"status" description:"状态"`
}
