/*
 * File: signup.ts
 * Description: Type definitions for signup flow
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */

// ============================================================================
// SIGNUP STEP TYPES
// ============================================================================

/**
 * SignUpStep Type
 * 
 * Purpose: Define the different steps in the signup process
 */
export type SignUpStep = 'email' | 'password' | 'name' | 'document' | 'hospital';

// ============================================================================
// SIGNUP DATA INTERFACES
// ============================================================================

/**
 * SignUpData Interface
 * 
 * Purpose: Complete signup data structure matching reference code
 */
export interface SignUpData {
  // Email and Password
  email: string;
  password: string;
  
  // Personal Information
  first_name: string;
  last_name: string;
  username: string;
  
  // Document
  id_photo_url: string | null;
  
  // Hospital Information
  hospital_id: string;
}

// ============================================================================
// STEP COMPONENT PROPS INTERFACES
// ============================================================================

/**
 * Base Step Props Interface
 * 
 * Purpose: Common props for all step components
 */
export interface BaseStepProps {
  onBack: () => void;
  data: Partial<SignUpData>;
  isLoading: boolean;
}

/**
 * Email Step Props Interface
 * 
 * Purpose: Props for email step component
 */
export interface EmailStepProps extends BaseStepProps {
  onContinue: (email: string) => void;
}

/**
 * Password Step Props Interface
 * 
 * Purpose: Props for password step component
 */
export interface PasswordStepProps extends BaseStepProps {
  onContinue: (password: string) => void;
}

/**
 * Name Step Props Interface
 * 
 * Purpose: Props for name step component
 */
export interface NameStepProps extends BaseStepProps {
  onContinue: (firstName: string, lastName: string, username: string) => void;
}

/**
 * Document Upload Step Props Interface
 * 
 * Purpose: Props for document upload step component
 */
export interface DocumentUploadStepProps extends BaseStepProps {
  onContinue: (documentUri: string) => void;
}

/**
 * Hospital Selection Step Props Interface
 * 
 * Purpose: Props for hospital selection step component
 */
export interface HospitalSelectionStepProps extends BaseStepProps {
  onContinue: (hospitalId: string) => void;
  hospitals: Hospital[] | null;
  hospitalLoading: boolean;
}

// ============================================================================
// VALIDATION INTERFACES
// ============================================================================

/**
 * Validation Result Interface
 * 
 * Purpose: Result of validation operations
 */
export interface ValidationResult {
  isValid: boolean;
  message?: string;
}

/**
 * Email Validation Result Interface
 * 
 * Purpose: Result of email validation
 */
export interface EmailValidationResult extends ValidationResult {
  isAvailable: boolean;
  suggestions?: string[];
}

/**
 * Username Validation Result Interface
 * 
 * Purpose: Result of username validation
 */
export interface UsernameValidationResult extends ValidationResult {
  isAvailable: boolean;
  suggestions?: string[];
}

// ============================================================================
// API RESPONSE INTERFACES
// ============================================================================

/**
 * SignUp API Response Interface
 * 
 * Purpose: Response from signup API
 */
export interface SignUpApiResponse {
  success: boolean;
  message: string;
  data?: {
    userId: string;
    email: string;
    token?: string;
  };
  errors?: {
    [key: string]: string[];
  };
}

/**
 * Email Validation API Response Interface
 * 
 * Purpose: Response from email validation API
 */
export interface EmailValidationApiResponse {
  success: boolean;
  isAvailable: boolean;
  message: string;
  suggestions?: string[];
}

/**
 * Username Validation API Response Interface
 * 
 * Purpose: Response from username validation API
 */
export interface UsernameValidationApiResponse {
  success: boolean;
  isAvailable: boolean;
  message: string;
  suggestions?: string[];
}

// ============================================================================
// HOSPITAL INTERFACES
// ============================================================================

/**
 * Hospital Interface
 * 
 * Purpose: Hospital information for selection
 */
export interface Hospital {
  hospital_id: string | null;
  hospital_name: string | null;
}

/**
 * Hospital List API Response Interface
 * 
 * Purpose: Response from hospital list API
 */
export interface HospitalListApiResponse {
  success: boolean;
  data: Hospital[];
  total: number;
  page: number;
  limit: number;
}

// ============================================================================
// FORM VALIDATION INTERFACES
// ============================================================================

/**
 * Form Validation Rules Interface
 * 
 * Purpose: Validation rules for form fields
 */
export interface FormValidationRules {
  required?: boolean;
  minLength?: number;
  maxLength?: number;
  pattern?: RegExp;
  custom?: (value: any) => boolean;
}

/**
 * Form Field Validation Interface
 * 
 * Purpose: Validation state for form fields
 */
export interface FormFieldValidation {
  isValid: boolean;
  message: string;
  isDirty: boolean;
  isTouched: boolean;
}

/**
 * Form Validation State Interface
 * 
 * Purpose: Overall form validation state
 */
export interface FormValidationState {
  [key: string]: FormFieldValidation;
}

/*
 * End of File: signup.ts
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */ 