package com.zcxk.client;

import com.zcxk.config.FeignConfig;

import com.zcxk.dict.Dict;
import com.zcxk.model.AjaxMessage;
import com.zcxk.task.entity.UserEntity;
import com.zcxk.org.Org;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "user-center",configuration={FeignConfig.class})
public interface UserCenterClient {

    @PostMapping("/user/getUserIdsByOrgId")
    List<Integer> getUserIdsByOrgId(@RequestParam("ids") String ids);

    @GetMapping("/dict/selectListByPCodes")
    Map<String, String> selectListByPCodes(@RequestParam String parentDictCodes);

    @GetMapping("/user/findUserIdsByOrgId")
    AjaxMessage<List<UserEntity>> findUserIdsByOrgId(@RequestParam("ids") String ids);


    @GetMapping("/user/findUserIdsByOrgIdAndType")
    AjaxMessage<List<UserEntity>> findUserIdsByOrgIdAndType(@RequestParam("ids") String ids);

    @PostMapping("/user/findUserIdsByUserIds")
    List<UserEntity> findUserIdsByUserIds(@RequestParam("ids") Long[] ids);

    @GetMapping("/user/findUserIdsForOrg")
    List<Long> findUserIdsForOrg();

    /**
     * 查询权限内的运维人员信息
     *
     * @return
     */
    @GetMapping("/user/findUserListByType")
    AjaxMessage<List<UserEntity>> findUserListByType();

    @PostMapping("/org/getAllByTenantId")
    List<Org> getAllByTenantId();

    @PostMapping(value = "/org/get")
    AjaxMessage<Org> selectOne(@RequestParam(value = "id") Integer id);
    /**
     * 通过父配置id查询数据
     */
    @RequestMapping(value = "/dict/selectList", method = RequestMethod.POST)
    AjaxMessage<List<Dict>> selectDictList(@RequestBody Dict dict);

    @PostMapping(value = "/user/findUserIdsByPermissonOrg")
    List<Integer> findUserIdsByPermissonOrg(
            @RequestParam(value = "tenantId", required = false) String tenantId,
            @RequestParam(value = "companyOrgId", required = false)Integer companyOrgId,
            @RequestParam(value = "deptOrgId", required = false)Integer deptOrgId);

    /**
     * 查询该时间内的运维人数
     */
    @RequestMapping(value = "/user/findMaintainerCount", method = RequestMethod.GET)
    Integer findMaintainerCount(@RequestParam("endDate") String endDate);

    @GetMapping(value = "/user/findAllUserList")
    List<UserEntity> findAllUserList(@RequestParam(value = "companyOrgId", required = false) Integer companyOrgId,
                                                  @RequestParam(value = "tenantId", required = false)String tenantId,
                                                  @RequestParam(value = "type", required = false)Integer type);
}
