import { request } from '../request';

// 参数接口
export interface UpdateParams {
  id?: number;
  name?: string;
  isActive?: Record<string, unknown>;
  createTime?: Record<string, unknown>;
  modifyTime?: Record<string, unknown>;
  createUid?: number;
  disabled?: string;
  description?: string;
}
// 响应接口
export interface UpdateRes {
  status: boolean;
  msg: string;
  data: Record<string, unknown>;
}

/**
 * 更新权限
 * @param {object} params EasSysPermission
 * @param {number} params.id ID
 * @param {string} params.name 权限名称
 * @param {object} params.isActive 是否激活
 * @param {object} params.createTime 创建时间
 * @param {object} params.modifyTime 修改时间
 * @param {number} params.createUid 创建用户ID
 * @param {string} params.disabled 状态
 * @param {string} params.description 权限描述
 * @returns
 */
export function update(params: UpdateParams) {
  return request.put(`/permission/update`, params);
}
// 参数接口
export interface QueryParams {
  id?: number;
  name?: string;
  description?: string;
  isActive?: string;
  createTime?: string;
  modifyTime?: string;
  createUid?: number;
  disabled?: string;
}

// 响应接口
export interface QueryRes {
  total: number;
  data: Record<string, unknown>;
}

/**
 * 查询权限
 * @param {string} pageNum
 * @param {string} pageSize
 * @param {object} params EasSysPermission
 * @param {number} params.id ID
 * @param {string} params.name 权限名称
 * @param {object} params.isActive 是否激活
 * @param {object} params.createTime 创建时间
 * @param {object} params.modifyTime 修改时间
 * @param {number} params.createUid 创建用户ID
 * @param {string} params.disabled 状态
 * @param {string} params.description 权限描述
 * @returns
 */
export function query(pageNum: number, pageSize: number, params: QueryParams) {
  return request.post(`/permission/query?pageNum=${pageNum}&pageSize=${pageSize}`, params);
}
// 参数接口
export interface Query_1Params {
  id?: number;
  depname?: string;
  address?: string;
  phone?: string;
  email?: string;
  manager?: string;
  createTime?: string;
  modifyTime?: string;
  createUid?: number;
  disabled?: string;
}

// 响应接口
export interface Query_1Res {
  status: boolean;
  msg: string;
  data: Record<string, unknown>;
  total: number;
}

/**
 * 查询部门
 * @param {string} pageNum
 * @param {string} pageSize
 * @param {object} params EasSysDepartment
 * @param {number} params.id
 * @param {string} params.depname 部门名称
 * @param {string} params.address 部门地址
 * @param {string} params.phone 部门电话
 * @param {string} params.email 部门电子邮箱
 * @param {string} params.manager 部门负责人
 * @param {object} params.createTime 创建时间
 * @param {object} params.modifyTime 修改时间
 * @param {number} params.createUid 创建用户ID
 * @param {string} params.disabled 状态
 * @returns
 */
export function query_1(pageNum: number, pageSize: number, params: Query_1Params) {
  return request.post(`/department/query?pageNum=${pageNum}&pageSize=${pageSize}`, params);
}
