/**
 * Backend DTO Types
 * FE-TYPE-005: Type definitions matching all backend DTOs exactly
 *
 * These types correspond exactly to the Go structs in veza-backend-api/internal/dto/
 * to ensure type safety between frontend and backend.
 */

/**
 * RegisterRequest DTO
 * Matches: internal/dto/register_request.go
 */
export interface RegisterRequest {
  username?: string; // omitempty, min=3, max=50
  email: string; // required, email
  password: string; // required, min=12
  password_confirm: string; // required, eqfield=Password
}

/**
 * RegisterResponse DTO
 * Matches: internal/dto/register_request.go
 */
export interface RegisterResponse {
  user: UserResponse;
  token: TokenResponse;
}

/**
 * LoginRequest DTO
 * Matches: internal/dto/login_request.go
 */
export interface LoginRequest {
  email: string; // required, email
  password: string; // required
  remember_me?: boolean; // optional
}

/**
 * LoginResponse DTO
 * Matches: internal/dto/login_request.go
 */
export interface LoginResponse {
  user: UserResponse;
  token?: TokenResponse; // omitempty
  requires_2fa?: boolean; // omitempty, BE-API-001: Flag indicating 2FA is required
}

/**
 * UserResponse DTO
 * Matches: internal/dto/register_request.go
 */
export interface UserResponse {
  id: string; // UUID
  email: string;
  username?: string; // omitempty
}

/**
 * TokenResponse DTO
 * Matches: internal/dto/register_request.go
 */
export interface TokenResponse {
  access_token: string;
  refresh_token: string;
  expires_in: number; // int
}

/**
 * RefreshRequest DTO
 * Matches: internal/dto/refresh_request.go
 */
export interface RefreshRequest {
  refresh_token: string; // required
}

/**
 * ResendVerificationRequest DTO
 * Matches: internal/dto/resend_verification_request.go
 */
export interface ResendVerificationRequest {
  email: string; // required, email
}

/**
 * ValidationError DTO
 * Matches: internal/dto/validation.go
 */
export interface ValidationError {
  field: string;
  message: string;
  value?: string; // omitempty
}

/**
 * ValidationErrors DTO
 * Matches: internal/dto/validation.go
 */
export interface ValidationErrors {
  errors: ValidationError[];
}
