// ================================================================================
// 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"
	v1 "kami/api/jd_cookie/v1"
	"kami/internal/consts"
	"kami/internal/model"
)

type (
	IJdCookie interface {
		// CreateAccount 创建Cookie账户
		CreateAccount(ctx context.Context, cookieValue string, accountName string, remark string) (cookieId string, status int, err error)
		// BatchCreateAccount 批量创建Cookie账户
		BatchCreateAccount(ctx context.Context, cookies []*v1.CreateAccountReq) (successIds []string, failedItems []*v1.BatchCreateResult, err error)
		// ListAccount 查询Cookie账户列表
		ListAccount(ctx context.Context, page int, size int, status consts.JdCookieStatus, keyword string) (list []*v1.CookieAccountInfo, total int, err error)
		// UpdateAccount 更新Cookie账户
		UpdateAccount(ctx context.Context, cookieId string, cookieValue string, accountName string, status consts.JdCookieStatus, remark string) (err error)
		// DeleteAccount 删除Cookie账户
		DeleteAccount(ctx context.Context, cookieId string) (err error)
		// BatchDeleteAccount 批量删除Cookie账户
		BatchDeleteAccount(ctx context.Context, cookieIds []string) (successIds []string, failedCount int, err error)
		// GetAccount 获取单个Cookie账户
		GetAccount(ctx context.Context, cookieId string) (account *v1.CookieAccountInfo, err error)
		// DeleteInvalidCookies 删除所有失效的Cookie
		DeleteInvalidCookies(ctx context.Context) (deletedCount int, successIds []string, failedCount int, results []*v1.CookieDeleteResult, err error)
		// ValidateCookie 验证单个Cookie是否有效
		ValidateCookie(ctx context.Context, cookieValue string) (isValid bool, message string, cookieId string, err error)
		// BatchValidateCookie 批量验证Cookie是否有效
		BatchValidateCookie(ctx context.Context, cookies []*v1.ValidateCookieItem) (results []*v1.BatchValidateResult, totalCount int, validCount int, invalidCount int, err error)
		// GetCookieHistory Cookie变更历史
		GetCookieHistory(ctx context.Context, cookieId string, page int, size int, changeType consts.CookieChangeType) (list []*v1.CookieHistoryInfo, total int, err error)
		// GetOrderHistory 订单变更历史
		GetOrderHistory(ctx context.Context, orderId string, page int, size int) (list []*v1.OrderHistoryInfo, total int, err error)
		// GetJdOrderHistoryByJdOrderId 根据京东订单ID获取京东订单历史
		GetJdOrderHistoryByJdOrderId(ctx context.Context, jdOrderId string, page int, size int) (list []*v1.JdOrderHistoryInfo, total int, err error)
		// CreateOrder 创建订单
		CreateOrder(ctx context.Context, req *model.CreateOrderReq) (result *model.CreateOrderResult, err error)
		// GetJdOrder 获取单个京东订单
		GetJdOrder(ctx context.Context, jdOrderId string) (order *v1.JdOrderInfo, err error)
		// ListJdOrder 京东订单列表查询
		ListJdOrder(ctx context.Context, page int, size int, status consts.JdOrderStatus, startTime string, endTime string, orderId string) (list []*v1.JdOrderInfo, total int, err error)
		// BatchCheckPaymentStatus 批量检查京东订单支付状态（定时任务）
		BatchCheckPaymentStatus(ctx context.Context) error
		// ExtractCardInfo 提取卡密信息
		ExtractCardInfo(ctx context.Context, jdOrderId string) error
		// CleanupExpiredOrders 清理过期订单（定时任务）
		CleanupExpiredOrders(ctx context.Context) error
		// ReleaseExpiredJdOrders 释放过期京东订单的关联（使其可以被复用）
		ReleaseExpiredJdOrders(ctx context.Context) error
		// ExportJdOrder 导出京东订单数据为Excel
		ExportJdOrder(ctx context.Context, status consts.JdOrderStatus, startTime string, endTime string, orderId string) (fileName string, content []byte, err error)
		// GetPaymentUrl 获取支付链接
		GetPaymentUrl(ctx context.Context, userOrderId string, orderId string) (result *model.PaymentResult, err error)
		// GetOrder 获取单个订单
		GetOrder(ctx context.Context, orderId string) (order *v1.OrderInfo, err error)
		// GetOrderStatus 查询订单状态
		GetOrderStatus(ctx context.Context, orderId string) (order *v1.OrderInfo, err error)
		// ListOrder 订单列表查询
		ListOrder(ctx context.Context, page int, size int, status consts.OrderStatus, startTime string, endTime string) (list []*v1.OrderInfo, total int, err error)
		// GetAvailableCookie 获取可用的Cookie（轮询分配）
		GetAvailableCookie(ctx context.Context) (cookieId string, err error)
		// UpdateCookieStatus 更新Cookie状态
		UpdateCookieStatus(ctx context.Context, cookieId string, status consts.JdCookieStatus, failureCount int, remark string) (err error)
		// CreateJdOrder 创建京东订单
		CreateJdOrder(ctx context.Context, jdOrderId string, payId string, cookieId string, category string, amount float64) (err error)
		// UpdateJdOrderStatus 更新京东订单状态
		UpdateJdOrderStatus(ctx context.Context, jdOrderId string, status consts.JdOrderStatus, wxPayUrl string, remark string) (err error)
		// RecordCookieHistory 记录Cookie变更历史
		RecordCookieHistory(ctx context.Context, req *model.RecordCookieHistoryReq) (err error)
		// RecordJdOrderHistory 记录京东订单变更历史
		RecordJdOrderHistory(ctx context.Context, jdOrderId string, changeType consts.JdOrderChangeType, orderId string, wxPayUrl string, remark string) (err error)
		// RecordOrderHistory 记录订单变更历史
		RecordOrderHistory(ctx context.Context, req *model.RecordOrderHistoryReq) (err error)
	}
)

var (
	localJdCookie IJdCookie
)

func JdCookie() IJdCookie {
	if localJdCookie == nil {
		panic("implement not found for interface IJdCookie, forgot register?")
	}
	return localJdCookie
}

func RegisterJdCookie(i IJdCookie) {
	localJdCookie = i
}
