package com.yuchen.saas.manage.system.api.feign;


import com.yuchen.saas.manage.system.api.entity.NestOrgRole;
import com.yuchen.saas.manage.system.api.entity.NestOrgRoleBinding;
import org.nest.springwrap.core.launch.app.AppNameConstant;
import org.nest.springwrap.core.tool.api.R;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(
        value = AppNameConstant.SAAS_SYSTEM,
        fallback = OrgRoleClientFallback.class
)
public interface IOrgRoleClient {
    String API_PREFIX = "/orgRole/feign";
    String List_BY_SEARCH = API_PREFIX + "/listBySearch";
    String List_BY_ORG_USER_ID = API_PREFIX + "/listByOrgRoleId";
    String ORG_BY_ID = API_PREFIX + "/getOrgRoleById";
    String LIST_BY_ORG_USER_ID=API_PREFIX + "/listByOrgUserId";

    String LIST_BY_ROLE_IDS = API_PREFIX + "/listByRoleIds";



    @GetMapping(List_BY_SEARCH)
    R<List<NestOrgRoleBinding>> listByUserIdAndTenantId(@RequestParam("userId") Long userId,@RequestParam("deptId") Long deptId);

    @GetMapping(List_BY_ORG_USER_ID)
    R<List<NestOrgRoleBinding>> listByOrgRoleId(@RequestParam("orgRoleId") Long orgRoleId);

    @GetMapping(ORG_BY_ID)
    R<NestOrgRole> getOrgRoleById(@RequestParam("orgRoleId") Long orgRoleId);

    @PostMapping(LIST_BY_ORG_USER_ID)
    R<List<NestOrgRoleBinding>> listByOrgUserId(@RequestBody Long orgUserId);

    @PostMapping(LIST_BY_ROLE_IDS)
    R<List<NestOrgRoleBinding>> listByRoleIds(@RequestBody List<Long> roleIds);

}
