package com.ai.da.service;


import com.ai.da.common.enums.CreditsEventsEnum;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.mapper.primary.entity.CreditsDetail;
import com.ai.da.model.dto.QueryIncomeOrExpenditureDTO;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;

public interface CreditsService extends IService<CreditsDetail> {

    Boolean buyCredits(Long accountId, Float quantity);

    String getCredits(Long accountId);

    void creditsRefund(Long accountId, Integer quantity, String orderNo);

    void insertToCreditsDetail(Long accountId, String changeEvent, String credits, String changeType, String orderNo);

    PageBaseResponse<CreditsDetail> queryCreditsDetailsPage(QueryIncomeOrExpenditureDTO queryPageByTimeDTO);

    Boolean checkCredits(Long accountId, CreditsEventsEnum event, Integer num);

    Boolean creditsPreDeduction(CreditsEventsEnum event, Integer num);

    Boolean creditsPreDeduction(Integer credits);

    void addRecordToCreditsDeduction(Long accountId, String taskId, CreditsEventsEnum creditsEventsEnum);

    void addRecordToCreditsDeduction(Long accountId, String taskId, CreditsEventsEnum creditsEventsEnum, Integer num);

    void deleteCreditsDeduction(Long accountId, String taskId);

    Boolean taskCreditsDeduction(Long accountId, String taskId);

    CreditsDetail getByAccountIdAndChangeEvent(Long accountId, String changeEvent, String changedCredits);

    void preInsert(Long accountId, String changeEventName, String taskId, Boolean isPreInsert, String changedCredits);

    void preInsert(Long accountId, String changeEventName, String taskId, Boolean isPreInsert, String changedCredits, Integer num);

    void updateChangedCredits(String accountId, String taskId);

    CreditsDetail queryDetailByTaskId(String taskId);

    void tokenUsage(Long accountId, BigDecimal totalTokenUsage);
}
