package com.czg.account.service;

import com.czg.account.dto.points.PointsExchangeRecordDTO;
import com.czg.account.entity.PointsExchangeRecord;
import com.czg.account.param.PointsExchangeCfParam;
import com.czg.account.param.PointsExchangeRecordParam;
import com.czg.account.param.PointsOrderCreateParam;
import com.czg.account.param.PointsOrderPayParam;
import com.czg.account.vo.PointsExchangeSummaryVo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;

/**
 * 积分兑换记录
 *
 * @author Tankaikai tankaikai@aliyun.com
 * @since 1.0 2025-02-25
 */
public interface PointsExchangeRecordService extends IService<PointsExchangeRecord> {

    /**
     * 获取积分兑换记录分页
     *
     * @param param 查询参数
     * @return 分页数据
     */
    Page<PointsExchangeRecordDTO> getPointsExchangeRecordPage(PointsExchangeRecordParam param);

    /**
     * 获取积分兑换记录详情
     *
     * @param id 兑换记录id
     * @return 兑换记录详情
     */
    PointsExchangeRecordDTO getPointsExchangeRecordById(Long id);

    /**
     * 核销券码
     *
     * @param couponCode 券码
     */
    void checkout(String couponCode);

    /**
     * 创建兑换订单
     *
     * @param param 兑换入参
     * @return 兑换详情
     */
    PointsExchangeRecordDTO create(PointsOrderCreateParam param);

    /**
     * 支付兑换订单
     *
     * @param param 支付入参
     * @return 支付结果
     */
    PointsExchangeRecordDTO pay(PointsOrderPayParam param);

    /**
     * 取消
     *
     * @param param 兑换记录
     */
    void cancel(PointsExchangeCfParam param);

    /**
     * 退款
     *
     * @param param 兑换记录
     */
    void refund(PointsExchangeCfParam param);

    /**
     * 统计兑换记录
     *
     * @param param 查询参数
     * @return 统计结果
     */
    PointsExchangeSummaryVo total(PointsExchangeRecordParam param);

    /**
     * 自动取消
     */
    void authCancel();

}