package com.kym.admin.controller;

import com.kym.common.R;
import com.kym.common.annotation.SysLog;
import com.kym.common.controller.IController;
import com.kym.entity.StationFeeRate;
import com.kym.entity.queryParams.PlatformFeeRateQueryParam;
import com.kym.service.StationFeeRateService;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 站点平台费率表 前端控制器
 * </p>
 *
 * @author skyline
 * @since 2025-04-18
 */
@RestController
@RequestMapping("/station-fee-rate")
public class StationFeeRateController extends IController {
    private final StationFeeRateService stationFeeRateService;

    public StationFeeRateController(StationFeeRateService stationFeeRateService) {
        this.stationFeeRateService = stationFeeRateService;
    }

    /**
     * 站点绑定平台费率配置
     *
     * @param stationFeeRate
     * @return Res
     */
    @PostMapping("bind")
    @SysLog(value = "新增站点平台费率配置")
    public R<?> bind(@Valid @RequestBody StationFeeRate stationFeeRate) {
        return resp((t) -> stationFeeRateService.bind(stationFeeRate));
    }

    /**
     * 获取平台费率配置
     *
     * @return Res
     */
    @GetMapping("{stationId}")
    @SysLog(value = "获取站点平台费率配置")
    public R<?> get(@PathVariable String stationId) {
        return resp(() -> stationFeeRateService.getStationFeeRate(stationId));
    }


    /**
     * 站点平台费率配置列表
     *
     * @return Res
     */
    @PostMapping("list")
    @SysLog(value = "站点平台费率配置列表")
    public R<?> list(@RequestBody PlatformFeeRateQueryParam params) {
        return resp(() -> stationFeeRateService.listStationPlatformFeeRate(params));
    }


}
