/**
 * Email template shared types — email-template-editor (wave-11 leaf-E).
 */

export const EMAIL_TEMPLATE_KEYS = [
  'invoice_sent',
  'invoice_reminder',
  'invoice_paid_receipt',
  'proposal_sent',
  'contract_signing_request',
  'portal_invitation',
  'lead_form_thank_you',
] as const

export type EmailTemplateKey = (typeof EMAIL_TEMPLATE_KEYS)[number]

export interface EmailTemplateListItem {
  key: EmailTemplateKey
  label: string
  subject: string
  isCustom: boolean
  updatedAt: string | null
}

export interface EmailTemplateDetail {
  key: EmailTemplateKey
  subject: string
  bodyHtml: string
  variables: string[]
  isCustom: boolean
}

export interface SaveEmailTemplateBody {
  subject: string
  bodyHtml: string
}

export interface PreviewEmailTemplateBody {
  subject: string
  bodyHtml: string
}

export interface PreviewEmailTemplateResponse {
  renderedHtml: string
  renderedSubject: string
}
