package v1

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

	"github.com/gogf/gf/v2/os/gtime"

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

// RechargeSubmitReq 礼品卡充值
type RechargeSubmitReq struct {
	g.Meta      `path:"/cardInfo/appleCard/submit" tags:"苹果礼品卡充值" method:"post" summary:"充值礼品卡"`
	CardNo      string  `json:"cardNo"  description:"卡号"`
	CardPass    string  `json:"cardPass"  description:"密码" v:"required#卡密不能为空"`
	FaceValue   float64 `json:"faceValue"  description:"面值" v:"required#面值不能为空"`
	CallbackUrl string  `json:"callbackUrl"  description:"回调地址"`
	Attach      string  `json:"attach"  description:"附加信息(目前是上游订单号)"`
	TimeStamp   int     `json:"timeStamp"  description:"时间戳"`
	Sign        string  `json:"sign"  description:"签名"`
	MerchantId  string  `json:"merchantId"  description:"商户ID"`
}

type RechargeSubmitRes struct {
	OrderNo string                          `json:"orderNo" description:"订单ID"`
	Status  consts.AppleRechargeOrderStatus `json:"status" description:"充值返回编码"`
	Message string                          `json:"message" description:"详细描述信息"`
}

type RechargeSubmitQueryReq struct {
	g.Meta  `path:"/cardInfo/appleCard/query" tags:"苹果礼品卡充值" method:"get" summary:"查询充值订单"`
	OrderNo string `json:"orderNo" v:"required#订单ID不能为空" description:"订单ID"`
}

type RechargeSubmitQueryRes struct {
	g.Meta  `json:"application/json"`
	Status  consts.AppleRechargeOrderStatus `json:"status" description:"充值返回编码"`
	Message string                          `json:"message" description:"详细描述信息"`
}

// RechargeListReq 礼品卡订单记录
type RechargeListReq struct {
	g.Meta `path:"/cardInfo/appleCard/rechargeOrder/list" tags:"苹果礼品卡充值" method:"get" summary:"获取充值记录列表"`
	commonApi.CommonPageReq
	Account    string      `json:"account" description:"账户"`
	AccountID  string      `json:"accountId" description:"账户ID"`
	Attach     string      `json:"attach" description:"附加信息"`
	OrderNo    string      `json:"orderNo" description:"订单ID"`
	CardNo     string      `json:"cardNo" description:"卡号"`
	CardPass   string      `json:"cardPass" description:"密码"`
	MerchantId string      `json:"merchantId" description:"商户ID"`
	StartDate  *gtime.Time `json:"StartDate" description:"开始时间"`
	EndDate    *gtime.Time `json:"EndDate" description:"结束时间"`
}

type RechargeListRes struct {
	commonApi.CommonPageRes[entity.V1CardAppleRechargeInfo]
}

// CallBackOrderManualReq 这个是回调订单给别人
type CallBackOrderManualReq struct {
	g.Meta  `path:"/cardInfo/appleCard/rechargeOrder/callbackByManual" tags:"轮询处理礼品卡" method:"post" summary:"手动回调iTunes账号到gateway，用来处理正确订单"`
	OrderNo string `json:"orderNo" v:"required#订单ID不能为空" description:"订单ID"`
	ID      int64  `json:"id" description:"充值ID"`
}

type CallBackOrderManualRes struct{}

type RechargeOrderModifyActualAmountReq struct {
	g.Meta       `path:"/cardInfo/appleCard/rechargeOrder/modifyActualAmount" tags:"轮询处理礼品卡" method:"post" summary:"手动处理金额" deprecated:"true"`
	OrderNo      string  `json:"orderNo" v:"required#订单ID不能为空" description:"订单ID"`
	ActualAmount float64 `json:"actualAmount" v:"required#金额不能为空" description:"金额"`
	TotpCode     string  `json:"totpCode" description:"TOTP"`
}

type RechargeOrderModifyActualAmountRes struct{}

type RechargeDuplicatedCardPassReq struct {
	g.Meta  `path:"/cardInfo/appleCard/rechargeOrder/setOrderSucceed" tags:"轮询处理礼品卡" method:"post" summary:"手动处理订单"`
	OrderNo string `json:"orderNo" v:"required#订单ID不能为空" description:"订单ID"`
}

type RechargeDuplicatedCardPassRes struct{}

// RechargeListDownloadReq 礼品卡订单记录
type RechargeListDownloadReq struct {
	g.Meta     `path:"/cardInfo/appleCard/rechargeOrder/download" tags:"苹果礼品卡充值" method:"get" summary:"获取充值记录列表"`
	AccountID  string      `json:"accountId" description:"账户ID"`
	Account    string      `json:"account" description:"账户"`
	Attach     string      `json:"attach" description:"附加信息"`
	OrderNo    string      `json:"orderNo" description:"订单ID"`
	CardNo     string      `json:"cardNo" description:"卡号"`
	MerchantId string      `json:"merchantId" description:"商户ID"`
	CardPass   string      `json:"cardPass" description:"密码"`
	StartDate  *gtime.Time `json:"StartDate" description:"开始时间"`
	EndDate    *gtime.Time `json:"EndDate" description:"结束时间"`
}

type RechargeListDownloadRes struct {
	g.Meta `mime:"zip"`
}

// RechargeOrderResetStatusReq 重置订单状态
type RechargeOrderResetStatusReq struct {
	g.Meta  `path:"/cardInfo/appleCard/rechargeOrder/resetStatus" tags:"苹果礼品卡充值" method:"post" summary:"重置订单状态"`
	OrderNo string `json:"orderNo" v:"required#订单ID不能为空" description:"订单ID"`
	Remark  string `json:"remark" description:"备注"`
	// Status  consts.AppleRechargeOrderStatus `json:"status" v:"required|in:10,11,12,13,20,30,31#状态不能为空|状态不正确" description:"状态"`
}

type RechargeOrderResetStatusRes struct{}
