package com.sonic.frog.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sonic.frog.domain.entity.UserDeductionStat;
import com.sonic.frog.enums.DeductionTypeEnum;

/**
 * 用户聊天、语音，语音通话扣费统计表 Service
 */
public interface UserDeductionStatService extends IService<UserDeductionStat> {

    /**
     * 发送文本聊天，语音聊天，语音通话扣费统计
     *
     * @param userId
     * @param aiId
     * @param deductionType
     */
    void userDeductionStat(Long userId, Long aiId, DeductionTypeEnum deductionType, String extra);

    /**
     * 定时任务，文本聊天，语音聊天超过10分钟未聊天扣费
     */
    Integer textOrVoiceTypeNoChatCheckoutJob();

    /**
     * 获取用户总预扣费金额
     *
     * @param userId
     * @return
     */
    Long getTotalDeductionAmount(Long userId);

    /**
     * 余额不足时，发起结算，生成流水
     *
     * @param userId
     */
    void userDeductionCheckout(Long userId);
}