// Common Type Definitions for IRU Services
// Replaces 'any' types with proper TypeScript interfaces

export interface PreliminaryInfo {
  organizationName: string;
  institutionalType: string;
  jurisdiction: string;
  estimatedVolume?: number;
  estimatedValue?: number;
  contactEmail: string;
  contactName: string;
  identifiers?: {
    taxId?: string;
    registrationNumber?: string;
    licenseNumber?: string;
  };
  [key: string]: unknown;
}

export interface QualificationResult {
  qualified: boolean;
  capacityTier: number;
  riskScore: number;
  recommendations: string[];
  nextSteps: string[];
  details?: Record<string, unknown>;
}

export interface DeploymentConfig {
  environment?: string;
  region?: string;
  networkConfig?: {
    vlan?: number;
    subnet?: string;
    gateway?: string;
  };
  resourceOverrides?: {
    cpu?: number;
    memory?: number;
    disk?: number;
  };
  [key: string]: unknown;
}

export interface ContainerResource {
  name: string;
  type: string;
  resources: {
    cpu: number;
    memory: number;
    disk: number;
  };
  network: {
    ip: string;
    vlan?: number;
  };
}

export interface ProvisioningResources {
  containers: ContainerResource[];
  network: {
    vlan: number;
    subnet: string;
    gateway: string;
  };
  storage: {
    total: number;
    pools: string[];
  };
}

export interface ProvisioningConfiguration {
  containers: Array<{
    name: string;
    config: Record<string, unknown>;
  }>;
  network: Record<string, unknown>;
  security: Record<string, unknown>;
}

export interface ProvisioningResult {
  subscriptionId: string;
  status: string;
  deploymentId: string;
  resources: ProvisioningResources;
  configuration: ProvisioningConfiguration;
  estimatedCompletion?: Date;
}

export interface SanctionsCheckDetails {
  list: 'OFAC' | 'EU' | 'UN' | 'OTHER';
  entityName: string;
  matchScore: number;
  reason: string;
  url?: string;
}

export interface AMLKYCDetails {
  verified: boolean;
  verificationLevel: 'basic' | 'standard' | 'enhanced';
  riskScore: number;
  riskLevel: 'low' | 'medium' | 'high';
  checks: Array<{
    type: 'identity' | 'address' | 'sanctions' | 'pep' | 'adverse_media';
    status: 'passed' | 'failed' | 'pending' | 'not_applicable';
    details?: string;
  }>;
}

export interface ComplianceCheckResult {
  passed: boolean;
  details: SanctionsCheckDetails | AMLKYCDetails | Record<string, unknown>;
}

export interface DeploymentMetadata {
  containers?: ContainerResource[];
  error?: string;
  rollbackReason?: string;
  rollbackAt?: Date;
  containersRemoved?: string[];
  [key: string]: unknown;
}

export interface WorkflowMetadata {
  qualificationState?: string;
  deploymentState?: string;
  currentStep?: string;
  [key: string]: unknown;
}

export interface DocuSignSignature {
  name: string;
  email: string;
  status: string;
  signedAt?: Date;
}

export interface HelloSignSignature {
  email: string;
  status: string;
  signedAt?: Date;
}

export interface InquiryFilter {
  status?: string;
  offeringId?: string;
  jurisdiction?: string;
  institutionalType?: string;
  limit?: number;
  offset?: number;
}

export interface UpdateInquiryData {
  status?: string;
  qualificationResult?: QualificationResult;
  capacityTier?: number;
  riskScore?: number;
  notes?: string;
  acknowledgedAt?: Date;
  reviewedAt?: Date;
  completedAt?: Date;
  preliminaryInfo?: PreliminaryInfo;
  [key: string]: unknown;
}
