package model

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

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

type V1CardAppleAccountInfo struct {
	commonApi.CommonStrId
	v1.AppleAccountRecord
	Status int `json:"status" description:"状态 0.停用 1.正常使用（待充值） 2.正在充值 3.已达到单日充值限制"`
}

type CardAppleAccountHistoryQueryInput struct {
	*v1.CardHistoryInfoListReq
	UserId string `json:"userId" description:"用户ID"`
}

type AppleCardWalletInfo struct {
	commonApi.CommonStrId
	Amount            float64 `json:"amount" description:"充值金额"`
	BalanceFromItunes float64 `json:"balanceFromItunes" description:"itunes充值后金额"`
	OrderNo           string  `json:"orderNo" description:"订单号"`
	Remark            string  `json:"remark" description:"备注"`
}

type AppleAccountRecordInput struct {
	v1.AppleAccountRecord
	UploadUserId string `json:"uploadUserId" description:"上传用户ID"`
}

type CardInfoParamsInput struct {
	commonApi.CommonPageReq
	UploadUserId string `json:"uploadUserId" description:"上传用户ID"`
	Account      string `json:"name"  description:"账户号"`
}

type AppleCardRechargeParamsInput struct {
	v1.RechargeListReq
	UserId string `json:"userId" description:"用户ID"`
}

type AppleCardRechargeListOutput struct {
	entity.V1CardAppleRechargeInfo
	AccountInfo V1CardAppleAccountInfoModel `json:"accountInfo" orm:"with:id=account_id"`
}

type V1CardAppleAccountInfoModel struct {
	g.Meta  `orm:"table:card_apple_account_info"`
	Id      string `json:"id"                    orm:"id"                      description:"主键"`
	Account string `json:"account"               orm:"account"                 description:"账户"`
}

type AppleCardRechargeInput struct {
	*v1.RechargeSubmitReq
	AccountID   string  `json:"accountId"`
	AccountName string  `json:"accountName"`
	Amount      float64 `json:"amount" description:"金额"`
	Balance     float64 `json:"balance" description:"余额"`
}

type AppleCardRechargeHistoryInput struct {
	RechargeId  int                        `json:"rechargeId"`
	OrderNo     string                     `json:"orderNo" description:"订单ID"`
	AccountID   string                     `json:"accountId"`
	AccountName string                     `json:"accountName"`
	Operation   consts.AppleOrderOperation `json:"operation" description:"操作"`
	Remark      string                     `json:"remark" description:"备注"`
}

type AppleCardTradeRecordInput struct {
	commonApi.CommonStrId
	RechargeAmount float64 `json:"rechargeAmount" description:"充值金额"`
}

type AppleCardAccountHistoryInput struct {
	AccountId           string  `json:"accountId" description:"账户ID"`
	OrderNo             string  `json:"orderId"`
	Amount              float64 `json:"amount"`
	BalanceBeforeItunes float64 `json:"balanceBefore" description:"充值前金额"`
	BalanceFromItunes   float64 `json:"balanceFromItunes" description:"itunes充值金额"`
	CreatedUserId       string  `json:"createdUserId" description:"创建人ID"`
	// BalanceFromAutoincrement float64 `json:"balanceFromAutoincrement" description:"itunes计算充值金额"`
	TransactionType string `json:"transactionType" description:"交易类型"`
	Description     string `json:"description"`
}

type AccountIdInfo struct {
	UserId    string `json:"id" description:"账户ID"`
	AccountId string `json:"accountId" description:"账户ID"`
}

type StealRuleAddInput struct {
	v1.RechargeStealRuleRecord
}

type StealRuleUpdateInput struct {
	v1.RechargeStealRuleRecord
	commonApi.CommonIntId
}

type StealRuleListInput struct {
	commonApi.CommonPageReq
}
