package com.red.circle.other.inner.endpoint.sys.api;

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.inner.model.cmd.sys.AddSysAdministratorCmd;
import com.red.circle.other.inner.model.cmd.sys.AppUserDetailsQryCmd;
import com.red.circle.other.inner.model.cmd.sys.SysAdministratorAuthCmd;
import com.red.circle.other.inner.model.cmd.sys.SysAdministratorAuthResourceCmd;
import com.red.circle.other.inner.model.cmd.sys.SysAdministratorChangeStatusCmd;
import com.red.circle.other.inner.model.dto.sys.AdministratorDTO;
import com.red.circle.other.inner.model.dto.sys.SysAdministratorAuthResourceDTO;
import com.red.circle.other.inner.model.dto.sys.SysAdministratorInfoDTO;
import java.util.List;
import java.util.Set;
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;

/**
 * 系统管理员.
 *
 * @author pengliang on 2023/8/11
 */
public interface AdministratorClientApi {

  String API_PREFIX = "/administrator/client";


  /**
   * 获取用户认证.
   *
   * @param userId 用户id
   */
  @GetMapping("/getByUserId")
  ResultResponse<AdministratorDTO> getByUserId(@RequestParam("userId") Long userId);

  /**
   * 是否可用.
   *
   * @return true 可用，false 不可以
   */
  @PostMapping("/checkAvailable")
  ResultResponse<Boolean> existsAvailable(@RequestBody Set<Long> userIds);

  @GetMapping("/getSysAdministratorAuthResource")
  ResultResponse<List<SysAdministratorAuthResourceDTO>> getSysAdministratorAuthResource();

  @GetMapping("/getSysAdministratorAuthResourceByUserId")
  ResultResponse<List<Long>> getSysAdministratorAuthResourceByUserId(
      @RequestParam("userId") Long userId);

  @PostMapping("/updateSysAdministratorAuthResource")
  ResultResponse<Void> updateSysAdministratorAuthResource(
      @RequestBody SysAdministratorAuthResourceCmd cmd);

  @PostMapping("/addSysAdministratorAuthResource")
  ResultResponse<Void> addSysAdministratorAuthResource(
      @RequestBody SysAdministratorAuthResourceCmd cmd);

  @GetMapping("/deleteSysAdministratorAuthResource")
  ResultResponse<Void> deleteSysAdministratorAuthResource(@RequestParam("id") Long id);

  @PostMapping("/deleteAndAddAdministratorAuth")
  ResultResponse<Void> deleteAndAddAdministratorAuth(@RequestBody SysAdministratorAuthCmd cmd);

  @PostMapping("/addSysAdministrator")
  ResultResponse<Void> addSysAdministrator(@RequestBody AddSysAdministratorCmd cmd);

  @PostMapping("/pageUserDetails")
  ResultResponse<PageResult<SysAdministratorInfoDTO>> pageUserDetails(
      @RequestBody AppUserDetailsQryCmd appUserDetailsQuery);

  @GetMapping("/deleteSysAdministrator")
  ResultResponse<Void> deleteSysAdministrator(@RequestParam("id") Long id);

  @PostMapping("/changeStatusAdministrator")
  ResultResponse<Void> changeStatusAdministrator(
      @RequestBody SysAdministratorChangeStatusCmd param);

  @GetMapping("/changeRoles")
  ResultResponse<Void> changeRoles(@RequestParam("id") Long id,
      @RequestParam("roles") String roles);
}
