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

import com.yuchen.saas.manage.system.api.entity.NestOrgUser;
import com.yuchen.saas.manage.system.api.request.OrgUserInfoRequest;
import com.yuchen.saas.manage.system.api.response.OrgUserInfoResponse;
import com.yuchen.saas.manage.system.api.vo.OrgUserListVO;
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.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@FeignClient(
	value = AppNameConstant.SAAS_SYSTEM,
	fallback = IOrgUserClientFallback.class
)
public interface IOrgUserClient {

	String API_PREFIX = "/orgUser";
	String FIND_PATROL_USER = API_PREFIX + "/findPatrolUser";
	String GET_ORG_USER_DETAIL = API_PREFIX + "/detail/{id}";
	String GET_ORG_USER_LIST = API_PREFIX + "/list";
	String FIND_ORG_USER_LIST_BY_IDS = API_PREFIX + "/findOrgUserListByIds";
	String FIND_ORG_USER_LIST_BY_DEPT_ID = API_PREFIX + "/findOrgUserListByDeptId";
	String LIST_BY_DEPT_ID = API_PREFIX + "/lsitByDeptId";
	String LIST_BY_IDS = API_PREFIX + "/listByIds";



	@GetMapping(FIND_PATROL_USER)
	R<List<OrgUserInfoResponse>> findPatrolUser(@SpringQueryMap OrgUserInfoRequest userInfoRequest);

	@GetMapping(GET_ORG_USER_DETAIL)
	R<NestOrgUser> detail(@PathVariable("id") Long id);

	@GetMapping(GET_ORG_USER_LIST)
	R<List<NestOrgUser>> findOrgUserList(@RequestParam("orgId") Long orgId);

	@PostMapping(FIND_ORG_USER_LIST_BY_IDS)
	R<List<NestOrgUser>> findOrgUserListByIds(@RequestBody List<Long> ids);

	@GetMapping(FIND_ORG_USER_LIST_BY_DEPT_ID)
	R<List<OrgUserListVO>> findOrgUserListByDeptId(@RequestParam Long depId);

	@PostMapping(LIST_BY_IDS)
	R<List<NestOrgUser>> listByIds(@RequestBody List<Long> ids);

	@GetMapping(LIST_BY_DEPT_ID)
	R<List<OrgUserListVO>> listByIds(@RequestParam Long depId);
}
