package com.yd.csf.api.controller;

import com.yd.common.result.Result;
import com.yd.csf.api.dto.ApiSalarySplitSummaryPageDTO;
import com.yd.csf.api.service.ApiSalarySplitService;
import com.yd.csf.feign.client.salarysplit.ApiSalarySplitFeignClient;
import com.yd.csf.feign.request.salarysplit.*;
import com.yd.csf.api.dto.ApiSalarySplitPageListDTO;
import com.yd.csf.feign.response.salarysplit.ApiCalculateToAmountResponse;
import com.yd.csf.feign.response.salarysplit.ApiQueryRemainingResponse;
import com.yd.csf.feign.response.salarysplit.ApiSalarySplitExportSummaryListResponse;
import com.yd.csf.feign.response.salarysplit.ApiSalarySplitQueryRateResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 薪资拆分应发信息
 *
 * @author zxm
 * @since 2026-03-11
 */
@RestController
@RequestMapping("/salarySplit")
@Validated
public class ApiSalarySplitController implements ApiSalarySplitFeignClient {

    @Autowired
    private ApiSalarySplitService apiSalarySplitService;

    /**
     * 分页查询-薪资拆分应发信息汇总列表
     * @param request
     * @return
     */
    @Override
    public Result<ApiSalarySplitSummaryPageDTO> summaryPage(ApiSalarySplitSummaryPageRequest request) {
        return apiSalarySplitService.summaryPage(request);
    }

    /**
     * 分页查询-薪资拆分应发信息列表
     * @param request
     * @return
     */
    @Override
    public Result<ApiSalarySplitPageListDTO> page(ApiSalarySplitPageRequest request) {
        return apiSalarySplitService.page(request);
    }

    /**
     * 批量保存-薪资拆分应发信息列表
     * @param request
     * @return
     */
    @Override
    public Result batchSave(ApiSalarySplitBatchSaveRequest request) {
        return apiSalarySplitService.batchSave(request);
    }

    /**
     * 查询-原币种剩余总金额和原币种
     * @param request
     * @return
     */
    @Override
    public Result<ApiQueryRemainingResponse> queryRemaining(ApiQueryRemainingRequest request) {
        return apiSalarySplitService.queryRemaining(request);
    }

    /**
     * 查询-原币种和原币种金额——>目标币种即时汇率和目标币种金额
     * @param request
     * @return
     */
    @Override
    public Result<ApiSalarySplitQueryRateResponse> queryRate(ApiSalarySplitQueryRateRequest request) {
        return apiSalarySplitService.queryRate(request);
    }

    /**
     * 计算-目标金额
     * @param request
     * @return
     */
    @Override
    public Result<ApiCalculateToAmountResponse> calculateToAmount(ApiCalculateToAmountRequest request) {
        return apiSalarySplitService.calculateToAmount(request);
    }

    /**
     * 导出-薪资拆分应发信息汇总列表
     * @param request
     * @return
     */
    @Override
    public Result<ApiSalarySplitExportSummaryListResponse> export(ApiSalarySplitExportSummaryListRequest request) {
        return apiSalarySplitService.export(request);
    }
}
