import type { EmailProcessingMode } from '../delivery/interfaces.js';

// Re-export EmailProcessingMode type
export type { EmailProcessingMode };


/**
 * Domain rule interface for pattern-based routing
 */
export interface IDomainRule {
  // Domain pattern (e.g., "*@example.com", "*@*.example.net")
  pattern: string;
  
  // Handling mode for this pattern
  mode: EmailProcessingMode;
  
  // Forward mode configuration
  target?: {
    server: string;
    port?: number;
    useTls?: boolean;
    authentication?: {
      user?: string;
      pass?: string;
    };
  };
  
  // MTA mode configuration
  mtaOptions?: IMtaOptions;
  
  // Process mode configuration
  contentScanning?: boolean;
  scanners?: IContentScanner[];
  transformations?: ITransformation[];
  
  // Rate limits for this domain
  rateLimits?: {
    maxMessagesPerMinute?: number;
    maxRecipientsPerMessage?: number;
  };
}

/**
 * MTA options interface
 */
export interface IMtaOptions {
  domain?: string;
  allowLocalDelivery?: boolean;
  localDeliveryPath?: string;
  dkimSign?: boolean;
  dkimOptions?: {
    domainName: string;
    keySelector: string;
    privateKey?: string;
  };
  smtpBanner?: string;
  maxConnections?: number;
  connTimeout?: number;
  spoolDir?: string;
}

/**
 * Content scanner interface
 */
export interface IContentScanner {
  type: 'spam' | 'virus' | 'attachment';
  threshold?: number;
  action: 'tag' | 'reject';
  blockedExtensions?: string[];
}

/**
 * Transformation interface
 */
export interface ITransformation {
  type: string;
  header?: string;
  value?: string;
  domains?: string[];
  append?: boolean;
  [key: string]: any;
}