import { PaginationRequest, PaginationResponse } from '@/types/common/type';
import { PermissionTreeKey } from '../permission/type';

/**
 * 角色列表row
 */
export interface Role {
  // 主键ID
  id: number;
  // 角色名
  roleName: string;
  // 备注
  remark: string;
  // 租户ID
  tenantId?: number; 
  isDeleted?: number;
  createdAt?: string;
  createdBy?: string;
  updatedAt?: string;
  updatedBy?: string;
}

/**
 * 角色列表请求参数
 */
export interface RolePageRequest extends PaginationRequest {
  queryParam?: {
    roleName: Role['roleName'];
    tenantId?: Role['tenantId'];
  };
}

/**
 * 角色列表数据
 */
export type RolePageResponse = PaginationResponse<Role>;


/**
 * 角色表单
 */
export interface RoleForm {
  id: number | null;
  roleName: string;
  remark: string;
  cameraIds: PermissionTreeKey[];
  menuIds: PermissionTreeKey[];
  permIds: PermissionTreeKey[];
  tenantId?: number;
}

export type AssignedPermissions = Pick<RoleForm, 'cameraIds' | 'menuIds' | 'permIds'>;

