package com.cf.imes.module.system.api.dept;

import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.system.api.dept.dto.DeptRespDTO;
import com.cf.imes.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = ApiConstants.NAME) // TODO 晨丰：fallbackFactory =
@Tag(name = "RPC 服务 - 部门")
public interface DeptApi {

    String PREFIX = ApiConstants.PREFIX + "/dept";

    @GetMapping(PREFIX + "/get")
    @Operation(summary = "获得部门信息")
    @Parameter(name = "id", description = "部门编号", example = "1024", required = true)
    CommonResult<DeptRespDTO> getDept(@RequestParam("id") Long id);

    @GetMapping(PREFIX + "/legitimacy/{deptId}")
    @Operation(summary = "校验部门是否合法")
    @Parameter(name = "id", description = "部门编号", example = "1024", required = true)
    CommonResult<Boolean> validateDept(@PathVariable("deptId") Long deptId);

}
