export type TaxCalcItemGroup = { id: string; taxRate?: number; usesDefaultTax?: boolean };
export type MaybePromise<T> = T | Promise<T>;

export interface PurchaseReferenceDataPort {
  getSettings(): MaybePromise<Record<string, unknown>>;
  getDefaultBaseCurrencyCode(): MaybePromise<string>;
  getIncomingChecks(): MaybePromise<Array<Record<string, any>>>;
  convertCurrency(amount: number, fromCode: string, toCode: string): MaybePromise<number>;
  assertNotLockedByPeriod(dateIso: string, periodCloseDate?: string, inventoryCloseDate?: string): void;
  getItemGroupsForTaxCalc(): Promise<TaxCalcItemGroup[]>;
  getTaxRateForMaterial(materialId: string, itemGroupMap: Map<string, any>, defaultTaxRate: number): number;
  getStockLocationsByMaterial(materialIds: string[]): MaybePromise<any[]>;
  nextPrefixedId(prefix: string): string;
}
