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"
)

// AppleAccountRecord 苹果账号信息
type AppleAccountRecord struct {
	v1.AppleAccountRecord
	commonApi.CommonStrId
	Balance float64 `json:"balance" description:"余额"`
	Status  int32   `json:"status" description:"状态 0.停用 1.正常使用（待充值） 2.正在充值 3.已达到单日充值限制"`

	MaxRechargeCount  int64   `json:"todayRechargeCount" description:"单日最大充值次数"`
	MaxRechargeAmount float64 `json:"maxRechargeAmount" description:"单日最大充值金额"`
}

type AppleAccountUpdateAmountRecord struct {
	OrderNo string  `json:"orderNo" description:"订单号"`
	Amount  float64 `json:"amount" description:"充值金额"`
	Status  consts.AppleRechargeOrderStatus
	Remark  string `json:"remark" description:"备注"`
}

type AppleAccountUpdateAmountAndHistoryRecord struct {
	OrderInfo         *AppleAccountUpdateAmountRecord
	HistoryOperation  consts.AppleOrderOperation `json:"operation" description:"操作"`
	AccountId         string                     `json:"accountId"`
	HistoryRemark     string                     `json:"remark" description:"备注"`
	WalletRemark      string                     `json:"walletRemark" description:"钱包备注"`
	BalanceFromItunes float64
}

type V1SysUserRecord struct {
	g.Meta   `orm:"table:sys_user"`
	Id       string `json:"id"           orm:"id"            description:"主键"`
	Username string `json:"username"     orm:"username"      description:"账号"`
	NickName string `json:"nickName"     orm:"nick_name"     description:"昵称"`
}

type AppleAccountListOutput struct {
	g.Meta `orm:"table:card_apple_account_info"`
	entity.V1CardAppleAccountInfo
	UploadUser V1SysUserRecord `json:"UploadUser"   orm:"with:id=created_user_id"`
}
