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

import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.system.api.organ.dto.OrgStatisticsReqDTO;
import com.cf.imes.module.system.api.organ.dto.OrganizationDTO;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;

@FeignClient(name = ApiConstants.NAME) // TODO 晨丰：fallbackFactory =
@Tag(name = "RPC 服务 - 多组织")
public interface OrganApi {

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

    @GetMapping(PREFIX + "/id-list")
    @Operation(summary = "获得所有组织编号")
    CommonResult<List<Long>> getOrganIdList();

    @GetMapping(PREFIX + "/valid")
    @Operation(summary = "校验组织是否合法")
    @Parameter(name = "id", description = "组织编号", required = true, example = "1024")
    CommonResult<Boolean> validOrgan(@RequestParam("id") Long id);

    @GetMapping(PREFIX + "/total/org")
    @Operation(summary = "组织总数查询")
    CommonResult<Map<String, Integer>> getOrgTotal();

    @PostMapping(PREFIX + "/separate/org")
    @Operation(summary = "新增、注销组织数量统计")
    CommonResult<Map<String, Object>> getOrgSeparate(@Valid OrgStatisticsReqDTO reqVO);

    @GetMapping(PREFIX + "/warn/org")
    @Operation(summary = "组织过期日期统计")
    CommonResult<Map<String, List<Object>>> getWarnToOrg();


    @GetMapping(PREFIX + "/organ-details")
    @Operation(summary = "根据组织ID获取组织的详细信息")
    CommonResult<OrganizationDTO> getOrganDetails(@RequestParam("organId") Long organId);


    @GetMapping(PREFIX + "/name-details")
    @Operation(summary = "根据组织名称获取组织的信息")
    CommonResult<List<OrganizationDTO>> getOrganDetailsByName(@RequestParam("organName") String organName);


}
