package com.yd.csf.feign.client.salary;

import com.yd.common.result.Result;
import com.yd.csf.feign.fallback.salary.ApiSalaryFeignFallbackFactory;
import com.yd.csf.feign.request.salary.*;
import com.yd.csf.feign.response.salary.ApiSalaryDetailResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;

/**
 * 香港保险服务-薪资单信息Feign客户端
 */
@FeignClient(name = "yd-csf-api", fallbackFactory = ApiSalaryFeignFallbackFactory.class)
public interface ApiSalaryFeignClient {

    /**
     * 分页查询-制作薪资单列表信息
     * @param request
     * @return
     */
    @PostMapping("/page")
    Result page(@Validated @RequestBody ApiSalaryPageRequest request);

    /**
     * 分页查询-电子薪资单列表信息（推送列表信息）
     * @param request
     * @return
     */
    @PostMapping("/push/page")
    Result pushPage(@Validated @RequestBody ApiSalaryPushPageRequest request);

    /**
     * 详情-薪资单信息
     * @param salaryBizId
     * @return
     */
    @GetMapping("/detail")
    Result<ApiSalaryDetailResponse> detail(@NotBlank(message = "薪资单表唯一业务ID不能为空") @RequestParam(value = "salaryBizId") String salaryBizId);

    /**
     * 新增-薪资单信息
     * @param request
     * @return
     */
    @PostMapping("/add")
    Result add(@Validated @RequestBody ApiSalaryAddRequest request);

    /**
     * 修改-薪资单信息
     * @param request
     * @return
     */
    @PutMapping("/edit")
    Result edit(@Validated @RequestBody ApiSalaryEditRequest request);

    /**
     * 提交核对
     * @param request
     * @return
     */
    @PutMapping("/submit/check")
    Result submitCheck(@Validated @RequestBody ApiSalarySubmitCheckRequest request);

    /**
     * 核对
     * @param request
     * @return
     */
    @PutMapping("/check")
    Result check(@Validated @RequestBody ApiSalaryCheckRequest request);

    /**
     * 推送
     * @param request
     * @return
     */
    @PutMapping("/push")
    Result push(@Validated @RequestBody ApiSalaryPushRequest request);

    /**
     * 取消薪资
     * @param request
     * @return
     */
    @PutMapping("/cancel")
    Result cancel(@Validated @RequestBody ApiSalaryCancelRequest request);

    /**
     * 批量新增-薪资单信息
     * @param request
     * @return
     */
    @PostMapping("/batch/add")
    Result batchAdd(@Validated @RequestBody ApiSalaryBatchAddRequest request);

    /**
     * 删除-薪资单汇款明细信息
     * @param salaryRemittanceBizId
     * @return
     */
    @DeleteMapping("/delSalaryRemittance")
    Result delSalaryRemittance(@NotBlank(message = "薪资汇款明细表唯一业务ID不能为空") @RequestParam(value = "salaryRemittanceBizId") String salaryRemittanceBizId);

    /**
     * 根据转介人和薪资年月查询应发总金额
     * @param request
     * @return
     */
    @PostMapping("/get/grossAmount")
    Result<BigDecimal> getGrossAmount(@Validated @RequestBody ApiSalaryGrossAmountRequest request);

    /**
     * 薪资单信息-汇款明细-查询汇率
     * @param request
     * @return
     */
    @PostMapping("/get/exchangeRate")
    Result<BigDecimal> getExchangeRate(@Validated @RequestBody ApiSalaryExchangeRateRequest request);

    /**
     * 计算-实发金额
     * @param request
     * @return
     */
    @PostMapping("/calculate/paidAmount")
    Result<BigDecimal> calculatePaidAmount(@Validated @RequestBody ApiSalaryCalculatePaidAmountRequest request);

    /**
     * 计算-薪资汇款明细合计发放金额（单位：HKD）
     * @param request
     * @return
     */
    @PostMapping("/calculate/totalAmount")
    Result<BigDecimal> calculateTotalAmount(@Validated @RequestBody ApiSalaryCalculateTotalAmountRequest request);
}
