export enum NotificationJobStatus { PENDING = "pending", PROCESSING = "processing", SENT = "sent", FAILED = "failed", CANCELLED = "cancelled", } export type NotificationChannel = "whatsapp" | "email" | "system"; export type NotificationJobType = | "creation" | "reminder" | "update" | "cancellation"; export interface NotificationJobPayload { email?: string; phoneNumber?: string; userId?: string; companyOwnerId?: string; subject?: string; message?: string; emailSubject?: string; emailMessage?: string; wapMessage?: string; systemSubject?: string; systemMessage?: string; } export interface INotificationJob { id?: string; companyId: string; appointmentId: string; clientId: string; channel: NotificationChannel; type: NotificationJobType; scheduledAt: Date; status: NotificationJobStatus; attempts: number; maxAttempts: number; lastError?: string; nextRetryAt?: Date; providerResponse?: string; payload?: NotificationJobPayload; createdAt: Date; updatedAt: Date; sentAt?: Date; } export interface CreateJobParams { companyId: string; appointmentId: string; clientId: string; channel: NotificationChannel; type: NotificationJobType; scheduledAt: Date; payload?: NotificationJobPayload; } export interface INotificationJobAdapter { create(data: CreateJobParams): Promise; findPendingDue(now: Date): Promise; updateStatus( jobId: string, status: NotificationJobStatus, data?: { lastError?: string; nextRetryAt?: Date; providerResponse?: string } ): Promise; cancelByAppointment(appointmentId: string): Promise; findByAppointment(appointmentId: string): Promise; }