// ================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================

package service

import (
	"context"
	"kami/internal/consts"
	"kami/internal/model"
	"kami/internal/model/entity"

	"github.com/gogf/gf/v2/database/gdb"
)

type (
	ICardRedeemAccount interface {
		// ReduceAmount 扣钱后并添加银行流水
		ReduceAmount(ctx context.Context, input *model.RedeemAccountAddHistory, tx gdb.TX) (err error)
		// ReduceAmountWithReduction 预扣款后并添加银行流水
		ReduceAmountWithReduction(ctx context.Context, input *model.RedeemAccountAddHistory, tx gdb.TX) (err error)
		// ReduceAmountWithReductionSucceed 添加预扣款成功记录
		ReduceAmountWithReductionSucceed(ctx context.Context, input *model.RedeemAccountReductionSucceed, tx gdb.TX) (err error)
		// ReduceAmountWithReductionFail 添加预扣款失败
		ReduceAmountWithReductionFail(ctx context.Context, input *model.RedeemAccountReductionSucceed, tx gdb.TX) (err error)
		// ReducePartialAmountWithFail 部分退款
		ReducePartialAmountWithFail(ctx context.Context, input *model.RedeemAccountReductionSucceed, tx gdb.TX) (err error)
		// ResetTodayAmountTotal 遍历重置今天的充值记录
		ResetTodayAmountTotal(ctx context.Context) (err error)
		// IncrementAmountCurrentCount 金额计数+1
		IncrementAmountCurrentCount(ctx context.Context, accountId string, amount float64, tx gdb.TX) (err error)
		// DecrementAmountCurrentCount 金额-1
		DecrementAmountCurrentCount(ctx context.Context, accountId string, amount float64, tx gdb.TX) (err error)
		// DecrementAmount 退减金额
		DecrementAmount(ctx context.Context, accountId string, amount float64, tx gdb.TX) (err error)
		// GetNormalOneByUserIdAndAmount 通过用户Id获取一个可用账户
		GetNormalOneByUserIdAndAmount(ctx context.Context, userId string, minAmount float64, tx gdb.TX) (data *entity.V1CardRedeemAccountInfo, err error)
		// AddDeductionRecord 添加预扣款记录
		AddDeductionRecord(ctx context.Context, input *model.RedeemOrderAddDeductionRecordInput, tx gdb.TX) (err error)
		GroupAdd(ctx context.Context, input *model.RedeemAccountGroup, tx gdb.TX) (id int64, err error)
		// GroupAddOrGetId 如果没有这个分组，就新建分组，否则返回这个分组的id
		GroupAddOrGetId(ctx context.Context, input *model.RedeemAccountGroup, tx gdb.TX) (id int64, err error)
		// GroupCheck 判断当前用户上传的name分组是不是已经存在
		GroupCheck(ctx context.Context, name string, createdUserId string, tx gdb.TX) (isExist bool, err error)
		// GroupUpdate 添加修改函数
		GroupUpdate(ctx context.Context, input *model.RedeemAccountGroup, id uint, tx gdb.TX) (err error)
		// GroupList 查询分组列表
		GroupList(ctx context.Context, input *model.RedeemAccountGroupList, tx gdb.TX) (total int, data []*entity.V1CardRedeemAccountGroup, err error)
		// GroupAll 查询分组列表
		GroupAll(ctx context.Context, input *model.RedeemAccountGroupAll, tx gdb.TX) (total int, data []*entity.V1CardRedeemAccountGroup, err error)
		// GroupDelete 删除某个分组
		GroupDelete(ctx context.Context, id uint, createdUserId string, tx gdb.TX) (err error)
		// GroupStatsOverview 获取分组统计概览
		GroupStatsOverview(ctx context.Context, input *model.RedeemAccountGroupStatsOverviewReq, tx gdb.TX) (output *model.RedeemAccountGroupStatsOverviewRes, err error)
		GroupStats(ctx context.Context, input *model.RedeemAccountGroupStatsInput, tx gdb.TX) (total int, output []*model.RedeemAccountGroupStatsOutput, err error)
		// AddHistory 添加操作历史
		AddHistory(ctx context.Context, input *model.RedeemAccountAddHistory, tx gdb.TX) (err error)
		// GetWalletHistory 获取单账户钱包明细
		GetWalletHistory(ctx context.Context, input *model.RedeemAccountHistoryQueryInput) (total int, data []*entity.V1CardRedeemAccountHistory, err error)
		Add(ctx context.Context, input *model.RedeemAccountAddInput, tx gdb.TX) (err error)
		AddWithGroup(ctx context.Context, input *model.RedeemAccountAddInput, tx gdb.TX) (err error)
		// UpdateCookie 更新cookie
		UpdateCookie(ctx context.Context, id string, cookie string, tx gdb.TX) (err error)
		// GetAccountByNameAndGroup 判断当前名称和分组想同的记录是否存在
		GetAccountByNameAndGroup(ctx context.Context, name string, groupId int, createdUserId string, category consts.CardRedeemAccountCategory, tx gdb.TX) (data entity.V1CardRedeemAccountInfo, err error)
		// Update 修改用户信息
		Update(ctx context.Context, data *model.RedeemAccountUpdateInput, tx gdb.TX) (err error)
		// Delete 删除账号
		Delete(ctx context.Context, id string, category consts.CardRedeemAccountCategory, tx gdb.TX) (err error)
		GetByCK(ctx context.Context, ck string) (data []*entity.V1CardRedeemAccountInfo, err error)
		// GetOneById 获取一个账号信息
		GetOneById(ctx context.Context, id string, tx gdb.TX) (data *entity.V1CardRedeemAccountInfo, err error)
		GetByNickname(ctx context.Context, nickName string) (data []*entity.V1CardRedeemAccountInfo, err error)
		GetByName(ctx context.Context, username string) (data []*entity.V1CardRedeemAccountInfo, err error)
		GetByGroup(ctx context.Context, groupId int) (data []*entity.V1CardRedeemAccountInfo, err error)
		Query(ctx context.Context, input *model.RedeemAccountQueryInput, tx gdb.TX) (data []*entity.V1CardRedeemAccountInfo, err error)
		GetNormalOneByUsername(ctx context.Context, username string, category consts.CardRedeemAccountCategory) (data *entity.V1CardRedeemAccountInfo, err error)
		GetNormalOneByCk(ctx context.Context, category consts.CardRedeemAccountCategory, username string) (data *entity.V1CardRedeemAccountInfo, err error)
		// List 获取所有苹果账户
		List(ctx context.Context, input *model.RedeemAccountListInput) (total int, data []*model.RedeemAccountOutput, err error)
		// GetRandomOne 随机获取一个京东账号
		GetRandomOne(ctx context.Context, tx gdb.TX) (data *entity.V1CardRedeemAccountInfo, err error)
		// CheckCurrentIsAvailable 判断当前账号是否可用
		CheckCurrentIsAvailable(ctx context.Context, id string, chargeAmount float64, tx gdb.TX) (isExist bool, err error)
		// GetAllAvailableAccount 获取所有可用的账号
		GetAllAvailableAccount(ctx context.Context, category consts.CardRedeemAccountCategory, chargeAmount float64, tx gdb.TX) (data []*entity.V1CardRedeemAccountInfo, err error)
		// GetAllNormalAccount 获取所有正常账户
		GetAllNormalAccount(ctx context.Context, tx gdb.TX) (data []*entity.V1CardRedeemAccountInfo, err error)
		// GetCountByStatus 获取指定状态的账号数量
		GetCountByStatus(ctx context.Context, status consts.RedeemAccountStatus) (count int, err error)
		// GetAllByUserId 下载当前上传账户所有数据
		GetAllByUserId(ctx context.Context, userId string, category consts.CardRedeemAccountCategory, tx gdb.TX) (data []*entity.V1CardRedeemAccountInfo, err error)
		// GetAll 获取所有账户
		GetAll(ctx context.Context, tx gdb.TX) (data []*entity.V1CardRedeemAccountInfo, err error)
		CheckAccountStatus(ctx context.Context, category consts.CardRedeemAccountCategory) (err error)
		// UpdateStatus 更新账号状态
		UpdateStatus(ctx context.Context, id string, status consts.RedeemAccountStatus, tx gdb.TX) (err error)
		// CheckForbiddenByTooFast 检查当前临时封禁账号是否解封
		CheckForbiddenByTooFast(ctx context.Context)
		GetAvailableAccount(ctx context.Context, category consts.CardRedeemAccountCategory, chargeAmount float64, tx gdb.TX) (output *entity.V1CardRedeemAccountInfo, err error)
		DailySummary(ctx context.Context) (err error)
		GetSummary(ctx context.Context, input *model.AccountDailySummaryGetInput, tx gdb.TX) (total int, output []*model.AccountDailySummaryGetOutput, err error)
	}
)

var (
	localCardRedeemAccount ICardRedeemAccount
)

func CardRedeemAccount() ICardRedeemAccount {
	if localCardRedeemAccount == nil {
		panic("implement not found for interface ICardRedeemAccount, forgot register?")
	}
	return localCardRedeemAccount
}

func RegisterCardRedeemAccount(i ICardRedeemAccount) {
	localCardRedeemAccount = i
}
