package com.cyksj.service.codex;

import com.cyksj.model.entity.CodexUser;
import com.cyksj.model.entity.GoodsDonSku;
import com.cyksj.model.entity.OrderDon;
import com.cyksj.model.request.CodexUpgradePayReq;
import com.cyksj.model.request.UpdateDailyLimitRequest;
import com.cyksj.model.request.codex.CodexUserPackageReq;
import com.cyksj.model.response.CodexDeductResp;
import com.cyksj.model.response.claudecode.ClaudeCodeResp;
import com.cyksj.model.views.CodexUserInfoView;

import java.util.Date;

/**
 * 项目名: yhlxj11111111
 * 文件名: CodexService
 * 创建者: Claude
 * 创建时间:2025/9/15
 */
public interface CodexService {
    
    /**
     * 获取用户Codex信息
     */
    CodexUserInfoView getCodexUserInfo(Long userId);
    
    /**
     * 创建或更新用户套餐
     */
    void createOrUpdateUserPackage(CodexUserPackageReq req);
    
    /**
     * 获取用户OpenAI使用统计
     */
    ClaudeCodeResp getUserOpenAIUsage(Long userId, String period);
    
    /**
     * 更新用户OpenAI每日美金限额
     */
    ClaudeCodeResp updateUserOpenAIDailyLimit(Long userId, UpdateDailyLimitRequest request);
    
    /**
     * 获取系统OpenAI指标统计
     */
    ClaudeCodeResp getSystemMetrics(String period, String metric);
    
    /**
     * 获取Java系统专用的用户OpenAI控制台数据
     */
    ClaudeCodeResp getJavaUserDashboard(Long userId);
    
    /**
     * 获取Java系统专用的用户OpenAI图表+明细联动数据
     */
    ClaudeCodeResp getJavaUserAnalytics(Long userId, String start, String end, Integer page, Integer limit, String order);

    void delCodexUser(Long userId, Long relationId);

    void createOrUpdateCodexUserInfo(Long orderId, Long relationId, Long userId, GoodsDonSku sku, Integer orderType);

    /**
     * 调用第三方api 更新codexUser
     */
	void updateCodexUserPackageInfo(CodexUser codexUser, Date expiryTime, GoodsDonSku finalSku);

    ClaudeCodeResp createOrUpdateCodexUserPackageApi(Long userId, String planName, Integer openaiDailyLimit, Integer openaiQuota, Date expiryTime) throws Exception;

    CodexDeductResp getDeductMoney(Long userId, Long relationId);

    OrderDon deductSubmitOrder(CodexUpgradePayReq payReq) throws Exception;

    Boolean getUserSubs(Long userId);

    CodexUserInfoView getUserSubsInfo(long userId);
}