package v1

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

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

type SysPaymentGetReq struct {
	g.Meta `path:"/sysUser/payment/list" tags:"用户充值" method:"get" summary:"用户充值列表"`
	commonApi.CommonPageReq
}

type SysPaymentGetRes struct {
	g.Meta `mime:"application/json"`
	commonApi.CommonPageRes[*entity.V1SysUserPayment]
}

type SysPaymentGetOneReq struct {
	g.Meta    `path:"/sysUser/payment/get" tags:"用户充值" method:"get" summary:"用户钱包详情"`
	UserId    string `p:"userId" description:"用户ID"`
	PaymentId int    `p:"paymentId" description:"钱包ID"`
}

type SysPaymentGetOneRes struct {
	g.Meta `mime:"application/json"`
	*entity.V1SysUserPayment
}

// SysPaymentAddReq 充值或消费
type SysPaymentAddReq struct {
	g.Meta          `path:"/sysUser/payment/add" tags:"用户充值" method:"post" summary:"充值"`
	UserId          string                            `json:"userId" description:"用户ID" v:"required#用户Id不能为空"`
	TransactionType consts.UserPaymentTransactionType `json:"transactionType" description:"交易类型" v:"required#交易类型不能为空"`
	Amount          decimal.Decimal                   `json:"amount" description:"充值金额" v:"required|min:0.001|max:99999999#充值金额不能为空|充值金额不能为0|充值金额不可大于99999999"`
	Remark          string                            `json:"remark" description:"备注"`
}

type SysPaymentAddRes struct{}

// SysPaymentRecordsGetReq 获取充值流水
type SysPaymentRecordsGetReq struct {
	g.Meta          `path:"/sysUser/paymentRecords/list" tags:"用户充值" method:"get" summary:"用户充值/消费流水"`
	UserId          string                            `p:"userId"`
	TransactionType consts.UserPaymentTransactionType `p:"transactionType"`
	commonApi.CommonPageReq
}

type SysPaymentRecordsGetRes struct {
	g.Meta `mime:"application/json"`
	commonApi.CommonPageRes[*entity.V1SysUserPaymentRecords]
}

// SysPaymentRecordsGetStatisticsReq 统计信息
type SysPaymentRecordsGetStatisticsReq struct {
	g.Meta `path:"/sysUser/statistics" tags:"用户管理" method:"get" summary:"用户信息统计"`
}
type SysPaymentRecordsGetStatisticsRes struct {
	Payment           *entity.V1SysUserPayment `json:"payment"`
	AppleAccountCount int                      `json:"appleAccountCount"`
}
