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 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
     */
    @PostMapping("/batch/add")
    Result batchAdd(@Validated @RequestBody ApiSalaryBatchAddRequest request);

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