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

import com.yd.common.result.Result;
import com.yd.csf.feign.fallback.csfclientuser.ApiCsfClientUserFeignFallbackFactory;
import com.yd.csf.feign.request.csfclientuser.ApiCsfClientUserAddRequest;
import com.yd.csf.feign.request.csfclientuser.ApiCsfClientUserEditRequest;
import com.yd.csf.feign.request.csfclientuser.ApiCsfClientUserPageRequest;
import com.yd.csf.feign.request.csfclientuser.ApiCsfClientUserTreeListRequest;
import com.yd.csf.feign.response.csfclientuser.ApiCsfClientUserDetailResponse;
import com.yd.csf.feign.response.csfclientuser.ApiCsfClientUserPageResponse;
import com.yd.csf.feign.response.csfclientuser.ApiCsfClientUserTreeListResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotBlank;

/**
 * 香港保险服务-CSF客户端用户信息接口Feign客户端
 */
@FeignClient(name = "yd-csf-api", fallbackFactory = ApiCsfClientUserFeignFallbackFactory.class)
public interface ApiCsfClientUserFeignClient {

    /**
     * 查询-左边人员信息树列表（组织架构管理树形列表）
     * @param request
     * @return
     */
    @PostMapping("/tree/list")
    Result<ApiCsfClientUserTreeListResponse> treeList(@Validated @RequestBody ApiCsfClientUserTreeListRequest request);

    /**
     * 分页查询-人员信息
     * @param request
     * @return
     */
    @PostMapping("/page")
    Result page(@Validated @RequestBody ApiCsfClientUserPageRequest request);

    /**
     * 详情-人员信息
     * @param csfClientUserBizId
     * @return
     */
    @GetMapping("/detail")
    Result<ApiCsfClientUserDetailResponse> detail(@NotBlank(message = "CSF客户端用户表唯一业务ID不能为空") @RequestParam(value = "csfClientUserBizId") String csfClientUserBizId);

    /**
     * 新增-人员信息
     * @param request
     * @return
     */
    @PostMapping("/add")
    Result add(@Validated @RequestBody ApiCsfClientUserAddRequest request);

    /**
     * 编辑-人员信息
     * @param request
     * @return
     */
    @PostMapping("/edit")
    Result edit(@Validated @RequestBody ApiCsfClientUserEditRequest request);
}
