package v1

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

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

type JDAccountDeleteReq struct {
	g.Meta `path:"/cardInfo/JDCard/account/delete" tags:"京东充值卡账户" method:"delete" summary:"删除京东充值卡"`
	commonApi.CommonStrId
}

type JDAccountDeleteRes struct{}

type JDAccountListReq struct {
	g.Meta `path:"/cardInfo/JDCard/account/getList" tags:"京东充值卡账户" method:"get" summary:"获取京东充值卡列表"`
	commonApi.CommonPageReq
	Name     string `json:"name" description:"账户名称"`
	NickName string `json:"nickName" description:"用户昵称"`
	Cookie   string `json:"cookie" dc:"cookie"`
}

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

type JDAccountListRes struct {
	commonApi.CommonPageRes[JDAccountListRecord]
}

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

type JDAccountCreateReq struct {
	g.Meta `path:"/cardInfo/JDCard/account/create" tags:"京东充值卡账户" method:"post" summary:"创建京东账户"`
	JDAccountRecord
}

type JDAccountCreateRes struct{}

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

type JDAccountCookieCheckRes 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 JDAccountUpdateReq struct {
	g.Meta `path:"/cardInfo/JDCard/account/update" tags:"京东充值卡账户" method:"put" summary:"修改京东账户"`
	commonApi.CommonStrId
	JDAccountRecord
}

type JDAccountUpdateRes struct {
}

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

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

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

type JDAccountUpdateStatusRes struct {
}

type JDAccountRefreshStatusReq struct {
	g.Meta `path:"/cardInfo/JDCard/account/refreshStatus" tags:"京东充值卡账户" method:"put" summary:"刷新账号充值状态"`
	commonApi.CommonStrId
}

type JDAccountRefreshStatusRes struct {
}

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

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

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

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

type JDAccountCookieBatchCheckRes struct {
	Msg  string                      `json:"msg" description:"导入结果"`
	List []*JDAccountCookieBatchInfo `json:"list" description:"导入结果"`
}
type JDAccountCookieBatchAddReq struct {
	g.Meta `path:"/cardInfo/JDCard/account/batchAdd" tags:"京东充值卡账户" method:"post" summary:"检查礼品卡是否正常"`
	List   []*JDAccountCookieBatchInfo `json:"list" description:"导入结果"`
}

type JDAccountCookieBatchAddRes struct {
}

type DownloadReq struct {
	g.Meta `path:"/cardInfo/JDCard/account/download" tags:"京东充值卡账户" method:"get" summary:"下载充值账户"`
}

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