package com.xy.service;

import com.xy.annotate.RestMappingController;
import com.xy.dto.DeviceAlgorithmChargingDto;
import com.xy.utils.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 设备算法计费表 服务类
 * </p>
 *
 * @author lijin
 * @since 2023-06-29
 */
@RestMappingController("/device-algorithm-charging")
public interface DeviceAlgorithmChargingService {

    /**
     * 购买
     *
     * @param pay
     * @return
     */
    @PostMapping("pay")
    R pay(@RequestBody @Validated DeviceAlgorithmChargingDto.Pay pay);

    /**
     * 购买回调
     *
     * @param payNotice
     * @return
     */
    @PostMapping("payNotice")
    R payNotice(@RequestBody @Validated DeviceAlgorithmChargingDto.PayNotice payNotice);

    /**
     * 扣费
     *
     * @param chargings
     * @return k=商户设备算法计费id v=未扣条数
     */
    @PostMapping("charging")
    R<Map<Long, Integer>> charging(@RequestBody List<DeviceAlgorithmChargingDto.Charging> chargings);

    /**
     * 有效条数统计
     *
     * @param validCount
     * @return
     */
    @PostMapping("validCount")
    R<Integer> validCount(@RequestBody @Validated DeviceAlgorithmChargingDto.ValidCount validCount);
}
