/**
 * Xero Node - Version 1
 * Discriminator: resource=invoice, operation=create
 */


interface Credentials {
  xeroOAuth2Api: CredentialReference;
}

/** Create a contact */
export type XeroV1InvoiceCreateParams = {
  resource: 'invoice';
  operation: 'create';
/**
 * Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;
 */
    organizationId?: string | Expression<string>;
/**
 * Invoice Type
 */
    type?: 'ACCPAY' | 'ACCREC' | Expression<string>;
/**
 * Contact ID
 */
    contactId?: string | Expression<string> | PlaceholderValue;
/**
 * Line item data
 * @default {}
 */
    lineItemsUi?: {
        /** Line Item
     */
    lineItemsValues?: Array<{
      /** A line item with just a description
       */
      description?: string | Expression<string> | PlaceholderValue;
      /** LineItem Quantity
       * @default 1
       */
      quantity?: number | Expression<number>;
      /** Lineitem unit amount. By default, unit amount will be rounded to two decimal places.
       */
      unitAmount?: string | Expression<string> | PlaceholderValue;
      /** Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;
       */
      itemCode?: string | Expression<string>;
      /** Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;
       */
      accountCode?: string | Expression<string>;
      /** Tax Type
       */
      taxType?: 'INPUT' | 'NONE' | 'OUTPUT' | 'GSTONIMPORTS' | Expression<string>;
      /** The tax amount is auto calculated as a percentage of the line amount based on the tax rate
       */
      taxAmount?: string | Expression<string> | PlaceholderValue;
      /** The line amount reflects the discounted price if a DiscountRate has been used
       */
      lineAmount?: string | Expression<string> | PlaceholderValue;
      /** Percentage discount or discount amount being applied to a line item. Only supported on ACCREC invoices - ACCPAY invoices and credit notes in Xero do not support discounts.
       */
      discountRate?: string | Expression<string> | PlaceholderValue;
    }>;
  };
/**
 * Additional Fields
 * @default {}
 */
    additionalFields?: {
    /** Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;
     */
    brandingThemeId?: string | Expression<string>;
    /** Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;
     */
    currency?: string | Expression<string>;
    /** The currency rate for a multicurrency invoice. If no rate is specified, the XE.com day rate is used.
     */
    currencyRate?: string | Expression<string> | PlaceholderValue;
    /** Date invoice was issued - YYYY-MM-DD. If the Date element is not specified it will default to the current date based on the timezone setting of the organisation.
     */
    date?: string | Expression<string>;
    /** Date invoice is due - YYYY-MM-DD
     */
    dueDate?: string | Expression<string>;
    /** Shown on sales invoices (Accounts Receivable) when this has been set
     */
    expectedPaymentDate?: string | Expression<string>;
    /** Invoice Number
     */
    invoiceNumber?: string | Expression<string> | PlaceholderValue;
    /** Line Amount Type
     * @default Exclusive
     */
    lineAmountType?: 'Exclusive' | 'Inclusive' | 'NoTax' | Expression<string>;
    /** Shown on bills (Accounts Payable) when this has been set
     */
    plannedPaymentDate?: string | Expression<string>;
    /** ACCREC only - additional reference number (max length = 255)
     */
    reference?: string | Expression<string> | PlaceholderValue;
    /** Whether the invoice in the Xero app should be marked as "sent". This can be set only on invoices that have been approved.
     * @default false
     */
    sendToContact?: boolean | Expression<boolean>;
    /** Status
     * @default DRAFT
     */
    status?: 'DRAFT' | 'SUBMITTED' | 'AUTHORISED' | Expression<string>;
    /** URL link to a source document - shown as "Go to [appName]" in the Xero app
     */
    url?: string | Expression<string> | PlaceholderValue;
  };
};

export type XeroV1InvoiceCreateOutput = {
  AmountPaid?: number;
  BrandingThemeID?: string;
  Contact?: {
    Addresses?: Array<{
      AddressType?: string;
      City?: string;
      Country?: string;
      PostalCode?: string;
      Region?: string;
    }>;
    BankAccountDetails?: string;
    ContactGroups?: Array<{
      ContactGroupID?: string;
      HasValidationErrors?: boolean;
      Name?: string;
      Status?: string;
    }>;
    ContactID?: string;
    ContactPersons?: Array<{
      EmailAddress?: string;
      FirstName?: string;
      IncludeInEmails?: boolean;
      LastName?: string;
    }>;
    ContactStatus?: string;
    EmailAddress?: string;
    HasValidationErrors?: boolean;
    IsCustomer?: boolean;
    IsSupplier?: boolean;
    Name?: string;
    Phones?: Array<{
      PhoneAreaCode?: string;
      PhoneCountryCode?: string;
      PhoneNumber?: string;
      PhoneType?: string;
    }>;
    UpdatedDateUTC?: string;
  };
  CurrencyCode?: string;
  CurrencyRate?: number;
  Date?: string;
  DateString?: string;
  HasErrors?: boolean;
  InvoiceID?: string;
  InvoiceNumber?: string;
  IsDiscounted?: boolean;
  LineAmountTypes?: string;
  LineItems?: Array<{
    Description?: string;
    LineItemID?: string;
    TaxType?: string;
  }>;
  Reference?: string;
  SentToContact?: boolean;
  Status?: string;
  Type?: string;
  UpdatedDateUTC?: string;
};

export type XeroV1InvoiceCreateNode = {
  type: 'n8n-nodes-base.xero';
  version: 1;
  credentials?: Credentials;
  config: NodeConfig<XeroV1InvoiceCreateParams>;
  output?: Items<XeroV1InvoiceCreateOutput>;
};