import { EmailQueueService } from '@/services/EmailQueueService';

interface JobInfo {
  title: string;
  company: string;
  id: string;
}

export async function sendApprovalEmail(employerEmail: string, employerName: string, job: JobInfo) {
  return await EmailQueueService.enqueueEmail('job_approved', employerEmail, {
    employerName,
    jobTitle: job.title,
    companyName: job.company,
    jobId: job.id
  });
}

export async function sendRejectionEmail(
  employerEmail: string,
  employerName: string,
  job: JobInfo,
  reason: string,
  details?: string
) {
  return await EmailQueueService.enqueueEmail('job_rejected', employerEmail, {
    employerName,
    jobTitle: job.title,
    companyName: job.company,
    jobId: job.id,
    reason,
    details
  });
}

export async function sendChangesRequestedEmail(
  employerEmail: string,
  employerName: string,
  job: JobInfo,
  instructions: string,
  priority: string = 'medium'
) {
  return await EmailQueueService.enqueueEmail('job_rejected', employerEmail, {
    employerName,
    jobTitle: job.title,
    companyName: job.company,
    jobId: job.id,
    reason: priority === 'high' ? 'High Priority Changes Requested' : 'Changes Requested by Admin',
    details: instructions
  });
}

export async function sendNewMessageNotificationEmail(
  recipientEmail: string,
  recipientName: string,
  senderName: string,
  jobTitle: string,
  messagePreview: string,
  applicationId: string
) {
  return await EmailQueueService.enqueueEmail('new_message', recipientEmail, {
    recipientName,
    senderName,
    jobTitle,
    messagePreview,
    applicationId
  });
}
