export type NotificationChannel = 'email' | 'sms' | 'push';

export type NotificationStatus = 
  | 'pending'
  | 'sent'
  | 'delivered'
  | 'failed'
  | 'bounced'
  | 'read';

export interface NotificationRecipient {
  userId: string;
  email?: string;
  phone?: string;
  fcmToken?: string;
  apnsToken?: string;
}

export interface EmailNotification {
  channel: 'email';
  to: string;
  from?: string;
  subject: string;
  htmlBody: string;
  textBody?: string;
  metadata?: Record<string, string>;
  attachments?: Array<{
    filename: string;
    content: Buffer;
    mimeType?: string;
  }>;
}

export interface SMSNotification {
  channel: 'sms';
  to: string;
  body: string;
  from?: string;
  metadata?: Record<string, string>;
}

export interface PushNotification {
  channel: 'push';
  userId: string;
  title: string;
  body: string;
  data?: Record<string, unknown>;
  badge?: number;
  sound?: string;
  category?: string;
}

export type Notification = EmailNotification | SMSNotification | PushNotification;

export interface NotificationResult {
  notificationId: string;
  channel: NotificationChannel;
  status: NotificationStatus;
  externalId?: string;
  error?: string;
  deliveredAt?: Date;
  readAt?: Date;
}

export interface NotificationTemplate {
  id: string;
  name: string;
  channel: NotificationChannel;
  subject?: string;
  body: string;
  locale: string;
  variables: string[];
  createdAt: Date;
  updatedAt: Date;
}

export interface NotificationPreference {
  userId: string;
  channel: NotificationChannel;
  enabled: boolean;
  categories: string[];
  updatedAt: Date;
}

export interface DeduplicationKey {
  userId: string;
  templateId: string;
  key: string;
  windowMinutes?: number;
  windowSeconds?: number;
}
