/**
 * Tipos TypeScript que correspondem exatamente aos DTOs do backend
 * Compatível com a estrutura Java/Spring Boot
 */

// Agent DTO - Compatível com br.gov.sigefp.rh.api.dto.AgentDTO
export interface AgentDTO {
  id: string; // UUID
  matricula: string; // Número de matrícula único
  nationalId: string; // Número de identificação nacional (CPF/NIF)
  fullName: string;
  birthDate: string; // LocalDate (YYYY-MM-DD)
  hireDate: string; // LocalDate (YYYY-MM-DD)
  terminationDate?: string; // LocalDate (YYYY-MM-DD) - opcional
  status: 'ACTIVE' | 'INACTIVE' | 'SUSPENDED' | 'TERMINATED';
  orgUnit?: string; // UUID
  position?: string; // UUID
  nationality?: string;
  phone?: string;
  email?: string;
  address?: string;
}

// UserAccount DTO - Compatível com br.gov.sigefp.admin.api.dto.UserAccountDTO
export interface UserAccountDTO {
  id: string; // UUID
  username: string;
  fullName: string;
  email: string;
  password?: string; // Opcional para updates
  isActive: boolean;
  createdAt: string; // Instant (ISO 8601)
  updatedAt: string; // Instant (ISO 8601)
  roleIds: string[]; // List<UUID>
}

// Role DTO - Compatível com br.gov.sigefp.admin.api.dto.RoleDTO
export interface RoleDTO {
  id: string; // UUID
  code: string;
  name: string;
  description?: string;
}

// AssignRoles DTO - Compatível com br.gov.sigefp.admin.api.dto.AssignRolesDTO
export interface AssignRolesDTO {
  roleIds: string[]; // List<UUID>
}

// AuditLog DTO - Compatível com br.gov.sigefp.admin.api.dto.AuditLogDTO
export interface AuditLogDTO {
  id: string; // UUID
  userId: string; // UUID
  userUsername?: string; // Nome do usuário para facilitar visualização
  module?: string;
  action: string;
  entity: string;
  entityId: string; // UUID
  description?: string;
  createdAt: string; // Instant (ISO 8601)
}

// Page Response - Compatível com Spring Data Page
export interface PageResponse<T> {
  content: T[];
  totalElements: number;
  totalPages: number;
  size: number;
  number: number; // página atual (0-indexed)
  first: boolean;
  last: boolean;
  numberOfElements?: number;
  empty?: boolean;
  sort?: {
    sorted: boolean;
    unsorted: boolean;
    empty: boolean;
  };
}

// Request para paginação
export interface PageRequest {
  page?: number;
  size?: number;
  sortBy?: string;
  sortDirection?: 'ASC' | 'DESC';
}
