/**
 * Xero Accounting API TypeScript Types
 * Comprehensive type definitions for Xero API entities
 */

// Branded types for IDs (Xero uses GUIDs)
export type InvoiceId = string & { readonly __brand: 'InvoiceId' };
export type ContactId = string & { readonly __brand: 'ContactId' };
export type AccountId = string & { readonly __brand: 'AccountId' };
export type BankTransactionId = string & { readonly __brand: 'BankTransactionId' };
export type PaymentId = string & { readonly __brand: 'PaymentId' };
export type ItemId = string & { readonly __brand: 'ItemId' };
export type TaxRateId = string & { readonly __brand: 'TaxRateId' };
export type EmployeeId = string & { readonly __brand: 'EmployeeId' };
export type OrganisationId = string & { readonly __brand: 'OrganisationId' };
export type TrackingCategoryId = string & { readonly __brand: 'TrackingCategoryId' };
export type TrackingOptionId = string & { readonly __brand: 'TrackingOptionId' };
export type AttachmentId = string & { readonly __brand: 'AttachmentId' };
export type CreditNoteId = string & { readonly __brand: 'CreditNoteId' };
export type PurchaseOrderId = string & { readonly __brand: 'PurchaseOrderId' };
export type QuoteId = string & { readonly __brand: 'QuoteId' };
export type ManualJournalId = string & { readonly __brand: 'ManualJournalId' };
export type BrandingThemeId = string & { readonly __brand: 'BrandingThemeId' };
export type ContactGroupId = string & { readonly __brand: 'ContactGroupId' };
export type PrepaymentId = string & { readonly __brand: 'PrepaymentId' };
export type OverpaymentId = string & { readonly __brand: 'OverpaymentId' };
export type BankTransferId = string & { readonly __brand: 'BankTransferId' };

// Enums and Constants
export enum InvoiceStatus {
  DRAFT = 'DRAFT',
  SUBMITTED = 'SUBMITTED',
  AUTHORISED = 'AUTHORISED',
  PAID = 'PAID',
  VOIDED = 'VOIDED',
  DELETED = 'DELETED'
}

export enum InvoiceType {
  ACCPAY = 'ACCPAY', // Bill
  ACCREC = 'ACCREC'  // Invoice
}

export enum LineAmountType {
  Exclusive = 'Exclusive',
  Inclusive = 'Inclusive',
  NoTax = 'NoTax'
}

export enum AccountType {
  BANK = 'BANK',
  CURRENT = 'CURRENT',
  CURRLIAB = 'CURRLIAB',
  DEPRECIATN = 'DEPRECIATN',
  DIRECTCOSTS = 'DIRECTCOSTS',
  EQUITY = 'EQUITY',
  EXPENSE = 'EXPENSE',
  FIXED = 'FIXED',
  INVENTORY = 'INVENTORY',
  LIABILITY = 'LIABILITY',
  NONCURRENT = 'NONCURRENT',
  OTHERINCOME = 'OTHERINCOME',
  OVERHEADS = 'OVERHEADS',
  PREPAYMENT = 'PREPAYMENT',
  REVENUE = 'REVENUE',
  SALES = 'SALES',
  TERMLIAB = 'TERMLIAB',
  PAYGLIABILITY = 'PAYGLIABILITY',
  SUPERANNUATIONEXPENSE = 'SUPERANNUATIONEXPENSE',
  SUPERANNUATIONLIABILITY = 'SUPERANNUATIONLIABILITY',
  WAGESEXPENSE = 'WAGESEXPENSE'
}

export enum AccountClass {
  ASSET = 'ASSET',
  EQUITY = 'EQUITY',
  EXPENSE = 'EXPENSE',
  LIABILITY = 'LIABILITY',
  REVENUE = 'REVENUE'
}

export enum BankTransactionStatus {
  AUTHORISED = 'AUTHORISED',
  DELETED = 'DELETED',
  VOIDED = 'VOIDED'
}

export enum BankTransactionType {
  RECEIVE = 'RECEIVE',
  SPEND = 'SPEND'
}

export enum PaymentStatus {
  AUTHORISED = 'AUTHORISED',
  DELETED = 'DELETED'
}

export enum CreditNoteStatus {
  DRAFT = 'DRAFT',
  SUBMITTED = 'SUBMITTED',
  AUTHORISED = 'AUTHORISED',
  PAID = 'PAID',
  VOIDED = 'VOIDED',
  DELETED = 'DELETED'
}

export enum CreditNoteType {
  ACCPAYCREDIT = 'ACCPAYCREDIT',
  ACCRECCREDIT = 'ACCRECCREDIT'
}

export enum PurchaseOrderStatus {
  DRAFT = 'DRAFT',
  SUBMITTED = 'SUBMITTED',
  AUTHORISED = 'AUTHORISED',
  BILLED = 'BILLED',
  DELETED = 'DELETED'
}

export enum QuoteStatus {
  DRAFT = 'DRAFT',
  SENT = 'SENT',
  ACCEPTED = 'ACCEPTED',
  DECLINED = 'DECLINED',
  INVOICED = 'INVOICED',
  DELETED = 'DELETED'
}

export enum ManualJournalStatus {
  DRAFT = 'DRAFT',
  POSTED = 'POSTED',
  DELETED = 'DELETED',
  VOIDED = 'VOIDED'
}

export enum TaxType {
  INPUT = 'INPUT',
  OUTPUT = 'OUTPUT',
  CAPEXINPUT = 'CAPEXINPUT',
  CAPEXOUTPUT = 'CAPEXOUTPUT',
  EXEMPTEXPENSES = 'EXEMPTEXPENSES',
  EXEMPTINCOME = 'EXEMPTINCOME',
  EXEMPTCAPITAL = 'EXEMPTCAPITAL',
  EXEMPTOUTPUT = 'EXEMPTOUTPUT',
  INPUTTAXED = 'INPUTTAXED',
  BASEXCLUDED = 'BASEXCLUDED',
  GSTONCAPIMPORTS = 'GSTONCAPIMPORTS',
  GSTONIMPORTS = 'GSTONIMPORTS',
  NONE = 'NONE',
  INPUT2 = 'INPUT2',
  ECZROUTPUT = 'ECZROUTPUT',
  ZERORATEDINPUT = 'ZERORATEDINPUT',
  ZERORATEDOUTPUT = 'ZERORATEDOUTPUT',
  REVERSECHARGES = 'REVERSECHARGES',
  RRINPUT = 'RRINPUT',
  RROUTPUT = 'RROUTPUT'
}

export type CurrencyCode = string; // e.g., 'USD', 'GBP', 'EUR', 'AUD', 'NZD'

// Address
export interface Address {
  AddressType?: 'POBOX' | 'STREET' | 'DELIVERY';
  AddressLine1?: string;
  AddressLine2?: string;
  AddressLine3?: string;
  AddressLine4?: string;
  City?: string;
  Region?: string;
  PostalCode?: string;
  Country?: string;
  AttentionTo?: string;
}

// Phone
export interface Phone {
  PhoneType?: 'DEFAULT' | 'DDI' | 'MOBILE' | 'FAX';
  PhoneNumber?: string;
  PhoneAreaCode?: string;
  PhoneCountryCode?: string;
}

// ContactPerson
export interface ContactPerson {
  FirstName?: string;
  LastName?: string;
  EmailAddress?: string;
  IncludeInEmails?: boolean;
}

// Contact
export interface Contact {
  ContactID?: ContactId;
  ContactNumber?: string;
  AccountNumber?: string;
  ContactStatus?: 'ACTIVE' | 'ARCHIVED' | 'GDPRREQUEST';
  Name: string;
  FirstName?: string;
  LastName?: string;
  EmailAddress?: string;
  SkypeUserName?: string;
  ContactPersons?: ContactPerson[];
  BankAccountDetails?: string;
  TaxNumber?: string;
  AccountsReceivableTaxType?: TaxType;
  AccountsPayableTaxType?: TaxType;
  Addresses?: Address[];
  Phones?: Phone[];
  IsSupplier?: boolean;
  IsCustomer?: boolean;
  DefaultCurrency?: CurrencyCode;
  UpdatedDateUTC?: string;
  ContactGroups?: ContactGroup[];
  SalesDefaultAccountCode?: string;
  PurchasesDefaultAccountCode?: string;
  SalesTrackingCategories?: TrackingCategory[];
  PurchasesTrackingCategories?: TrackingCategory[];
  TrackingCategoryName?: string;
  TrackingCategoryOption?: string;
  PaymentTerms?: {
    Bills?: { Day?: number; Type?: 'DAYSAFTERBILLDATE' | 'DAYSAFTERBILLMONTH' | 'OFCURRENTMONTH' | 'OFFOLLOWINGMONTH' };
    Sales?: { Day?: number; Type?: 'DAYSAFTERBILLDATE' | 'DAYSAFTERBILLMONTH' | 'OFCURRENTMONTH' | 'OFFOLLOWINGMONTH' };
  };
  Discount?: number;
  Balances?: {
    AccountsReceivable?: {
      Outstanding?: number;
      Overdue?: number;
    };
    AccountsPayable?: {
      Outstanding?: number;
      Overdue?: number;
    };
  };
  BatchPayments?: {
    BankAccountNumber?: string;
    BankAccountName?: string;
    Details?: string;
  };
}

// ContactGroup
export interface ContactGroup {
  ContactGroupID?: ContactGroupId;
  Name: string;
  Status?: 'ACTIVE' | 'DELETED';
  Contacts?: Contact[];
}

// TrackingCategory
export interface TrackingCategory {
  TrackingCategoryID?: TrackingCategoryId;
  TrackingCategoryName?: string;
  Name?: string;
  Status?: 'ACTIVE' | 'ARCHIVED' | 'DELETED';
  Options?: TrackingOption[];
}

// TrackingOption
export interface TrackingOption {
  TrackingOptionID?: TrackingOptionId;
  Name?: string;
  Status?: 'ACTIVE' | 'ARCHIVED' | 'DELETED';
  TrackingCategoryID?: TrackingCategoryId;
}

// LineItemTracking
export interface LineItemTracking {
  TrackingCategoryID?: TrackingCategoryId;
  TrackingOptionID?: TrackingOptionId;
  Name?: string;
  Option?: string;
}

// InvoiceLineItem
export interface InvoiceLineItem {
  LineItemID?: string;
  Description?: string;
  Quantity?: number;
  UnitAmount?: number;
  ItemCode?: string;
  AccountCode?: string;
  AccountID?: AccountId;
  TaxType?: TaxType;
  TaxAmount?: number;
  LineAmount?: number;
  DiscountRate?: number;
  DiscountAmount?: number;
  Tracking?: LineItemTracking[];
  Item?: Item;
}

// Invoice
export interface Invoice {
  InvoiceID?: InvoiceId;
  Type?: InvoiceType;
  InvoiceNumber?: string;
  Reference?: string;
  Payments?: Payment[];
  CreditNotes?: CreditNote[];
  Prepayments?: Prepayment[];
  Overpayments?: Overpayment[];
  AmountDue?: number;
  AmountPaid?: number;
  AmountCredited?: number;
  CurrencyRate?: number;
  IsDiscounted?: boolean;
  HasAttachments?: boolean;
  HasErrors?: boolean;
  Contact: Contact;
  DateString?: string;
  Date?: string;
  DueDateString?: string;
  DueDate?: string;
  Status?: InvoiceStatus;
  LineAmountTypes?: LineAmountType;
  LineItems?: InvoiceLineItem[];
  SubTotal?: number;
  TotalTax?: number;
  Total?: number;
  UpdatedDateUTC?: string;
  CurrencyCode?: CurrencyCode;
  FullyPaidOnDate?: string;
  BrandingThemeID?: BrandingThemeId;
  Url?: string;
  SentToContact?: boolean;
  ExpectedPaymentDate?: string;
  PlannedPaymentDate?: string;
  RepeatingInvoiceID?: string;
  Attachments?: Attachment[];
}

// Bill (same as Invoice but type=ACCPAY)
export type Bill = Invoice;

// Account
export interface Account {
  AccountID?: AccountId;
  Code: string;
  Name?: string;
  Type?: AccountType;
  Class?: AccountClass;
  Status?: 'ACTIVE' | 'ARCHIVED' | 'DELETED';
  Description?: string;
  BankAccountNumber?: string;
  BankAccountType?: 'BANK' | 'CREDITCARD' | 'PAYPAL';
  CurrencyCode?: CurrencyCode;
  TaxType?: TaxType;
  EnablePaymentsToAccount?: boolean;
  ShowInExpenseClaims?: boolean;
  ReportingCode?: string;
  ReportingCodeName?: string;
  HasAttachments?: boolean;
  UpdatedDateUTC?: string;
  AddToWatchlist?: boolean;
}

// BankTransaction
export interface BankTransaction {
  BankTransactionID?: BankTransactionId;
  Type?: BankTransactionType;
  Contact: Contact;
  LineItems: InvoiceLineItem[];
  BankAccount: Account;
  IsReconciled?: boolean;
  DateString?: string;
  Date?: string;
  Reference?: string;
  CurrencyCode?: CurrencyCode;
  CurrencyRate?: number;
  Url?: string;
  Status?: BankTransactionStatus;
  LineAmountTypes?: LineAmountType;
  SubTotal?: number;
  TotalTax?: number;
  Total?: number;
  UpdatedDateUTC?: string;
  HasAttachments?: boolean;
  Attachments?: Attachment[];
}

// BankTransfer
export interface BankTransfer {
  BankTransferID?: BankTransferId;
  FromBankAccount: Account;
  ToBankAccount: Account;
  Amount: number;
  Date?: string;
  DateString?: string;
  CurrencyRate?: number;
  FromBankTransactionID?: BankTransactionId;
  ToBankTransactionID?: BankTransactionId;
  HasAttachments?: boolean;
  CreatedDateUTC?: string;
  Attachments?: Attachment[];
}

// Payment
export interface Payment {
  PaymentID?: PaymentId;
  Date?: string;
  CurrencyRate?: number;
  Amount?: number;
  Reference?: string;
  IsReconciled?: boolean;
  Status?: PaymentStatus;
  PaymentType?: 'ACCRECPAYMENT' | 'ACCPAYPAYMENT' | 'ARCREDITPAYMENT' | 'APCREDITPAYMENT' | 'AROVERPAYMENTPAYMENT' | 'ARPREPAYMENTPAYMENT' | 'APPREPAYMENTPAYMENT' | 'APOVERPAYMENTPAYMENT';
  UpdatedDateUTC?: string;
  HasAccount?: boolean;
  HasValidationErrors?: boolean;
  Invoice?: Invoice;
  CreditNote?: CreditNote;
  Prepayment?: Prepayment;
  Overpayment?: Overpayment;
  Account?: Account;
  BankAmount?: number;
  Details?: string;
}

// Prepayment
export interface Prepayment {
  PrepaymentID?: PrepaymentId;
  Type?: 'RECEIVE-PREPAYMENT' | 'SPEND-PREPAYMENT';
  Contact?: Contact;
  Date?: string;
  Status?: 'AUTHORISED' | 'PAID' | 'VOIDED';
  LineAmountTypes?: LineAmountType;
  LineItems?: InvoiceLineItem[];
  SubTotal?: number;
  TotalTax?: number;
  Total?: number;
  UpdatedDateUTC?: string;
  CurrencyCode?: CurrencyCode;
  CurrencyRate?: number;
  Reference?: string;
  RemainingCredit?: number;
  Allocations?: {
    Invoice?: Invoice;
    Amount?: number;
    Date?: string;
  }[];
  Payments?: Payment[];
  HasAttachments?: boolean;
  Attachments?: Attachment[];
}

// Overpayment
export interface Overpayment {
  OverpaymentID?: OverpaymentId;
  Type?: 'RECEIVE-OVERPAYMENT' | 'SPEND-OVERPAYMENT';
  Contact?: Contact;
  Date?: string;
  Status?: 'AUTHORISED' | 'PAID' | 'VOIDED';
  LineAmountTypes?: LineAmountType;
  LineItems?: InvoiceLineItem[];
  SubTotal?: number;
  TotalTax?: number;
  Total?: number;
  UpdatedDateUTC?: string;
  CurrencyCode?: CurrencyCode;
  CurrencyRate?: number;
  RemainingCredit?: number;
  Allocations?: {
    Invoice?: Invoice;
    Amount?: number;
    Date?: string;
  }[];
  Payments?: Payment[];
  HasAttachments?: boolean;
  Attachments?: Attachment[];
}

// CreditNote
export interface CreditNote {
  CreditNoteID?: CreditNoteId;
  CreditNoteNumber?: string;
  Type?: CreditNoteType;
  Contact?: Contact;
  Date?: string;
  DueDate?: string;
  Status?: CreditNoteStatus;
  LineAmountTypes?: LineAmountType;
  LineItems?: InvoiceLineItem[];
  SubTotal?: number;
  TotalTax?: number;
  Total?: number;
  UpdatedDateUTC?: string;
  CurrencyCode?: CurrencyCode;
  CurrencyRate?: number;
  RemainingCredit?: number;
  Allocations?: {
    Invoice?: Invoice;
    Amount?: number;
    Date?: string;
  }[];
  Payments?: Payment[];
  BrandingThemeID?: BrandingThemeId;
  HasAttachments?: boolean;
  Attachments?: Attachment[];
  Reference?: string;
  SentToContact?: boolean;
}

// PurchaseOrder
export interface PurchaseOrder {
  PurchaseOrderID?: PurchaseOrderId;
  PurchaseOrderNumber?: string;
  DateString?: string;
  Date?: string;
  DeliveryDateString?: string;
  DeliveryDate?: string;
  DeliveryAddress?: string;
  AttentionTo?: string;
  Telephone?: string;
  DeliveryInstructions?: string;
  ExpectedArrivalDate?: string;
  Contact?: Contact;
  BrandingThemeID?: BrandingThemeId;
  Status?: PurchaseOrderStatus;
  LineAmountTypes?: LineAmountType;
  LineItems?: InvoiceLineItem[];
  SubTotal?: number;
  TotalTax?: number;
  Total?: number;
  UpdatedDateUTC?: string;
  CurrencyCode?: CurrencyCode;
  CurrencyRate?: number;
  HasAttachments?: boolean;
  Attachments?: Attachment[];
  SentToContact?: boolean;
  Reference?: string;
}

// Quote
export interface Quote {
  QuoteID?: QuoteId;
  QuoteNumber?: string;
  Reference?: string;
  Terms?: string;
  Contact?: Contact;
  LineItems?: InvoiceLineItem[];
  Date?: string;
  DateString?: string;
  ExpiryDate?: string;
  ExpiryDateString?: string;
  Status?: QuoteStatus;
  CurrencyCode?: CurrencyCode;
  CurrencyRate?: number;
  SubTotal?: number;
  TotalTax?: number;
  Total?: number;
  TotalDiscount?: number;
  Title?: string;
  Summary?: string;
  BrandingThemeID?: BrandingThemeId;
  UpdatedDateUTC?: string;
  LineAmountTypes?: LineAmountType;
  Url?: string;
  HasAttachments?: boolean;
  Attachments?: Attachment[];
}

// JournalLine
export interface JournalLine {
  JournalLineID?: string;
  AccountID?: AccountId;
  AccountCode?: string;
  LineAmount?: number;
  TaxType?: TaxType;
  TaxAmount?: number;
  Description?: string;
  Tracking?: LineItemTracking[];
}

// ManualJournal
export interface ManualJournal {
  ManualJournalID?: ManualJournalId;
  Narration: string;
  JournalLines?: JournalLine[];
  Date?: string;
  DateString?: string;
  Status?: ManualJournalStatus;
  LineAmountTypes?: LineAmountType;
  Url?: string;
  ShowOnCashBasisReports?: boolean;
  HasAttachments?: boolean;
  UpdatedDateUTC?: string;
  Attachments?: Attachment[];
}

// Item
export interface Item {
  ItemID?: ItemId;
  Code: string;
  Name?: string;
  Description?: string;
  PurchaseDescription?: string;
  PurchaseDetails?: {
    UnitPrice?: number;
    AccountCode?: string;
    TaxType?: TaxType;
  };
  SalesDetails?: {
    UnitPrice?: number;
    AccountCode?: string;
    TaxType?: TaxType;
  };
  IsTrackedAsInventory?: boolean;
  InventoryAssetAccountCode?: string;
  TotalCostPool?: number;
  QuantityOnHand?: number;
  UpdatedDateUTC?: string;
  IsSold?: boolean;
  IsPurchased?: boolean;
}

// TaxComponent
export interface TaxComponent {
  Name?: string;
  Rate?: number;
  IsCompound?: boolean;
  IsNonRecoverable?: boolean;
}

// TaxRate
export interface TaxRate {
  TaxRateID?: TaxRateId;
  Name?: string;
  TaxType?: TaxType;
  Status?: 'ACTIVE' | 'DELETED' | 'ARCHIVED';
  ReportTaxType?: string;
  CanApplyToAssets?: boolean;
  CanApplyToEquity?: boolean;
  CanApplyToExpenses?: boolean;
  CanApplyToLiabilities?: boolean;
  CanApplyToRevenue?: boolean;
  DisplayTaxRate?: number;
  EffectiveRate?: number;
  TaxComponents?: TaxComponent[];
}

// Currency
export interface Currency {
  Code: CurrencyCode;
  Description?: string;
}

// Employee (basic accounting, not payroll)
export interface Employee {
  EmployeeID?: EmployeeId;
  Status?: 'ACTIVE' | 'DELETED';
  FirstName?: string;
  LastName?: string;
  ExternalLink?: {
    Url?: string;
  };
}

// BrandingTheme
export interface BrandingTheme {
  BrandingThemeID?: BrandingThemeId;
  Name?: string;
  LogoUrl?: string;
  Type?: 'STANDARD' | 'CUSTOM';
  SortOrder?: number;
  CreatedDateUTC?: string;
}

// Organisation
export interface Organisation {
  OrganisationID?: OrganisationId;
  APIKey?: string;
  Name?: string;
  LegalName?: string;
  PaysTax?: boolean;
  Version?: 'AU' | 'GB' | 'NZ' | 'US' | 'GLOBAL';
  OrganisationType?: 'COMPANY' | 'CHARITY' | 'CLUBSOCIETY' | 'PARTNERSHIP' | 'PRACTICE' | 'PERSON' | 'SOLETRADER' | 'TRUST';
  BaseCurrency?: CurrencyCode;
  CountryCode?: string;
  IsDemoCompany?: boolean;
  OrganisationStatus?: string;
  RegistrationNumber?: string;
  TaxNumber?: string;
  FinancialYearEndDay?: number;
  FinancialYearEndMonth?: number;
  SalesTaxBasis?: 'ACCRUALS' | 'CASH' | 'FLATRATECASH' | 'NONE';
  SalesTaxPeriod?: 'MONTHLY' | 'QUARTERLY' | 'ANNUALLY' | 'NONE';
  DefaultSalesTax?: string;
  DefaultPurchasesTax?: string;
  PeriodLockDate?: string;
  EndOfYearLockDate?: string;
  CreatedDateUTC?: string;
  Timezone?: string;
  OrganisationEntityType?: string;
  ShortCode?: string;
  LineOfBusiness?: string;
  Addresses?: Address[];
  Phones?: Phone[];
  ExternalLinks?: Array<{ LinkType?: string; Url?: string }>;
  PaymentTerms?: {
    Bills?: { Day?: number; Type?: string };
    Sales?: { Day?: number; Type?: string };
  };
}

// Attachment
export interface Attachment {
  AttachmentID?: AttachmentId;
  FileName?: string;
  Url?: string;
  MimeType?: string;
  ContentLength?: number;
  IncludeOnline?: boolean;
}

// Report types
export interface ReportCell {
  Value?: string;
  Attributes?: Array<{ Value?: string; Id?: string }>;
}

export interface ReportRow {
  RowType?: 'Header' | 'Section' | 'Row' | 'SummaryRow';
  Cells?: ReportCell[];
  Title?: string;
  Rows?: ReportRow[];
}

export interface Report {
  ReportID?: string;
  ReportName?: string;
  ReportType?: string;
  ReportTitles?: string[];
  ReportDate?: string;
  UpdatedDateUTC?: string;
  Rows?: ReportRow[];
}

export interface BalanceSheet extends Report {
  ReportType: 'BalanceSheet';
}

export interface ProfitAndLoss extends Report {
  ReportType: 'ProfitAndLoss';
}

export interface TrialBalance extends Report {
  ReportType: 'TrialBalance';
}

export interface BankSummary extends Report {
  ReportType: 'BankSummary';
}

export interface BudgetSummary extends Report {
  ReportType: 'BudgetSummary';
}

export interface ExecutiveSummary extends Report {
  ReportType: 'ExecutiveSummary';
}

// Pagination
export interface PaginationParams {
  page?: number;
  pageSize?: number;
}

export interface PaginatedResponse<T> {
  data: T[];
  page?: number;
  pageSize?: number;
  totalPages?: number;
  totalRecords?: number;
}

// API Response wrappers
export interface XeroApiResponse<T> {
  Id?: string;
  Status?: string;
  ProviderName?: string;
  DateTimeUTC?: string;
  [key: string]: T[] | T | string | undefined;
}

export interface XeroErrorResponse {
  Type?: string;
  Title?: string;
  Status?: number;
  Detail?: string;
  Instance?: string;
  Elements?: Array<{
    ValidationErrors?: Array<{
      Message?: string;
    }>;
  }>;
}

// Client configuration
export interface XeroClientConfig {
  accessToken: string;
  tenantId: string;
  baseUrl?: string;
  timeout?: number;
  retryAttempts?: number;
  retryDelayMs?: number;
}

// Request options
export interface XeroRequestOptions {
  summarizeErrors?: boolean;
  ifModifiedSince?: Date;
  page?: number;
  pageSize?: number;
  where?: string;
  order?: string;
  includeArchived?: boolean;
}
