// Type definitions for the ImageInput component and related utilities

export interface ImageInputProps {
  /** Current value (file, URL string, or null) */
  value?: File | string | null;
  /** Callback when value changes */
  onChange: (file: File | string | null) => void;
  /** Callback for validation results */
  onValidation?: (result: ImageValidationResult) => void;
  /** Whether the input is disabled */
  disabled?: boolean;
  /** Additional CSS classes */
  className?: string;
  /** Maximum file size in bytes (default: 10MB) */
  maxSize?: number;
  /** File input accept attribute */
  accept?: string;
  /** Placeholder text for URL input */
  placeholder?: string;
  /** Whether to show image preview */
  showPreview?: boolean;
  /** CSS classes for preview container */
  previewClassName?: string;
}

export interface ImageInputState {
  /** Current input mode ('file' or 'url') */
  mode: 'file' | 'url';
  /** Validation result */
  validation: ImageValidationResult | null;
  /** Whether validation is in progress */
  isValidating: boolean;
  /** Error message */
  error: string | null;
  /** Preview data URL */
  previewUrl: string | null;
}

export interface ImageValidationResult {
  /** Whether the input is valid */
  isValid: boolean;
  /** Error message if invalid */
  error?: string;
  /** Detected MIME type */
  detectedType?: string;
  /** Original filename */
  filename?: string;
}

export interface ImageInputMode {
  /** Type of input */
  type: 'file' | 'url' | null;
  /** Input value */
  value?: File | string;
}

// Types from validation module
export type ImageExtension = 
  | 'jpg' | 'jpeg' | 'png' | 'gif' | 'webp' | 'bmp' | 'svg' | 'tiff';

export type ImageMimeType = 
  | 'image/jpeg' | 'image/jpg' | 'image/png' | 'image/gif' 
  | 'image/webp' | 'image/bmp' | 'image/svg+xml' | 'image/tiff';