export type ManualInvoiceSourceType = 'MANUAL'
export type ManualInvoiceTemplateCode = 'PROFORMA_INVOICE_V1'

export interface ManualInvoiceDocumentPayload {
  invoice_date: string
  booking_date: string
  due_date: string
}

export interface ManualInvoiceRecipientPayload {
  company_code: string | null
  contact_id: string | null
  company: string
  attention: string
  address: string
  telephone: string
  email: string
}

export interface ManualInvoiceBookingPayload {
  group_name: string
  arrival_date: string
  departure_date: string
  room_rate_note: string | null
  extra_bed_rate: number | null
}

export interface ManualInvoiceChargePayload {
  description: string
  room_type: string
  quantity: number
  rate: number
  nights: number
}

export interface ManualInvoicePayload {
  document: ManualInvoiceDocumentPayload
  recipient: ManualInvoiceRecipientPayload
  booking: ManualInvoiceBookingPayload
  charges: ManualInvoiceChargePayload[]
}

export interface ManualInvoiceGenerationRequest {
  hotel_id?: string
  source_type: ManualInvoiceSourceType
  task_id: null
  order_id: null
  template_code: ManualInvoiceTemplateCode
  invoice_payload: ManualInvoicePayload
}

export interface ManualInvoiceTotalsResult {
  subtotal: number
  vat: number
  total: number
  currency: string
}

export interface ManualInvoiceGenerationResult {
  invoice_generation_id: string
  generation_status: string
  source_type: ManualInvoiceSourceType
  hotel_id: string
  order_id: string | null
  task_id: string | null
  template_code: ManualInvoiceTemplateCode
  pdf_url: string | null
  pdf_object_key: string | null
  generated_excel_object_key: string | null
  totals: ManualInvoiceTotalsResult
  created_at: string
}
