export type EmailConfigurationProviderType = 'smtp';
export type EmailConfigurationTestStatus = 'not_tested' | 'passed' | 'failed';

export interface EmailConfigurationSummary {
  id: string;
  organizationId: string;
  providerType: EmailConfigurationProviderType;
  name: string;
  host: string;
  port: number;
  secure: boolean;
  username: string | null;
  fromEmail: string;
  fromName: string | null;
  replyToEmail: string | null;
  isDefault: boolean;
  isActive: boolean;
  hasPassword: boolean;
  lastTestStatus: EmailConfigurationTestStatus;
  lastTestedAt: string | null;
  lastTestError: string | null;
  createdBy: string;
  updatedBy: string;
  createdAt: string;
  updatedAt: string;
}

export interface EmailConfigurationPayload {
  providerType: EmailConfigurationProviderType;
  name: string;
  host: string;
  port: number;
  secure: boolean;
  username?: string | null;
  password?: string | null;
  clearPassword?: boolean;
  fromEmail: string;
  fromName?: string | null;
  replyToEmail?: string | null;
  isDefault?: boolean;
  isActive?: boolean;
}

export interface EmailConnectionTestResult {
  ok: boolean;
  detail?: string;
}

export interface SendTestEmailPayload {
  recipientEmail: string;
}

export interface SendTestEmailResult {
  providerMessageId: string | null;
  acceptedRecipients: string[];
  rejectedRecipients: string[];
  metadata?: Record<string, unknown>;
}
