package com.qnfhq.modules.c2c.service;

import com.qnfhq.common.page.PageData;
import com.qnfhq.common.service.BaseService;
import com.qnfhq.common.service.CrudService;
import com.qnfhq.common.utils.Result;
import com.qnfhq.modules.c2c.dto.*;
import com.qnfhq.modules.c2c.entity.C2cAdEntity;

import java.math.BigDecimal;
import java.util.Map;

/**
 * c2c商家广告
 *
 * @author yelz 30262728@qq.com
 * @since 1.0.0 2025-11-17
 */
public interface C2cAdService extends BaseService<C2cAdEntity> {

    public Result createAd(C2cAdCreateDTO c2cAdDTO, long loginId) throws Exception;

    public Result cancelAd(C2cAdEntity ad) throws Exception;

    PageData<C2cAdEntity> page(Map<String, Object> params);

    /**
     *  设置广告缓存
     * @param c2cAd
     */
    void setAdCache(C2cAdEntity c2cAd);

    public void deleteAdCache(Long c2cAdId,String payway,String legalCoin,String symbol,Integer direction);

    public Result queryTranAd(C2cAdTranDTO tranDTO);

    public Result selectC2cAdViewList(C2cAdViewDTO viewDTO);

    /**
     * 从redis中获取广告信息
     * @param id
     * @return
     */
    C2cAdEntity selectAdFromRedis(Long id);

    /**
     * 禁用广告
     * @param c2cAd
     * @return
     */
    boolean updateC2cAdDisabled(C2cAdEntity c2cAd);



    /**
     * 删除广告缓存
     * @param c2cAd
     */
    void deleteC2cAdCache(C2cAdEntity c2cAd);

    /**
     *  修改广告可用数量
     * @param id
     * @param symbolNum
     * @param maxAmount
     * @param status
     * @param version
     * @return
     */
    int updateC2cAdAvailableNumById(Long id, BigDecimal symbolNum,BigDecimal maxAmount,Integer status,Long version);

    /**
     * 增加广告可用数量
     * @param id
     * @param symbolNum
     * @param maxAmount
     * @param version
     * @return
     */
    int addC2cAdAvailableNumById(Long id, BigDecimal symbolNum,BigDecimal maxAmount,Long version);
}