import * as business from "./index.js";
import * as finance from "../finance/index.js";

/**
 * Letter-specific envelope extending the base document type
 */
export type TLetterEnvelope<TYPE extends string, FIELDS> = business.TDocumentEnvelope<
  TYPE,
  {
    /**
     * The incident or case ID this letter relates to
     */
    incidenceId: string;
    
    /**
     * The sender of the letter
     */
    from: business.TContact;
    
    /**
     * The recipient of the letter
     */
    to: business.TContact;
    
    /**
     * The legal contact is the contact that is responsible for the letter
     * this is often the same as the from contact, but not always
     */
    legalContact?: business.TContact;
    
    /**
     * Subject line of the letter
     */
    subject: string;
    
    /**
     * Cover sheet configuration for the letter
     */
    coverSheet?: {
      enabled: boolean;
      coverSheetText: string;
      /**
       * if true, the cover sheet will be marked as confidential
       * hinting that only authorized persons should handle the letter
       */
      confidential: boolean;
    };
  } & FIELDS
>;

export type TLetterSimple = TLetterEnvelope<"simple", {}>;


export type TLetter = TLetterSimple | finance.TInvoice
