import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes } from 'sequelize'; import { TenantModel } from '../tenant-model'; export declare class TaxRate extends TenantModel, InferCreationAttributes> { id: CreationOptional; livemode: boolean; instance_did?: string; active: boolean; country: string; state?: string; postal_code?: string; tax_code?: string; percentage: number; display_name: string; description?: string; metadata?: Record; created_at: CreationOptional; updated_at: CreationOptional; static readonly GENESIS_ATTRIBUTES: { id: { type: DataTypes.StringDataType; primaryKey: boolean; allowNull: boolean; defaultValue: (size?: number) => string; }; livemode: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; active: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: boolean; }; country: { type: DataTypes.StringDataType; allowNull: boolean; }; state: { type: DataTypes.StringDataType; allowNull: boolean; }; postal_code: { type: DataTypes.StringDataType; allowNull: boolean; }; tax_code: { type: DataTypes.StringDataType; allowNull: boolean; }; percentage: { type: DataTypes.DecimalDataType; allowNull: boolean; }; display_name: { type: DataTypes.StringDataType; allowNull: boolean; }; description: { type: DataTypes.StringDataType; allowNull: boolean; }; metadata: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; created_at: { type: DataTypes.DateDataTypeConstructor; defaultValue: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; updated_at: { type: DataTypes.DateDataTypeConstructor; defaultValue: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; }; static initialize(sequelize: any): void; static associate(): void; /** * Find matching tax rate for given location and tax code * * Uses hierarchical scoring (lexicographic ordering) to match tax rates. * Priority: postal_code > state > tax_code * * Note: Country is pre-filtered to ensure postal codes are compared within * the correct national context (e.g., prevents US 90210 from matching CA 90210). * * Score ranges per dimension (0-100): * - 100: Exact match * - 50-95: Wildcard match (e.g., "902*" prefix matching) * - 10: General fallback (rate has no restriction) * - 5: Both empty */ static findMatchingRate({ country, state, postalCode, taxCode, livemode, }: { country: string; state?: string; postalCode?: string; taxCode?: string; livemode?: boolean; }): Promise; /** * Calculate tax amount from tax-inclusive total * Formula: tax = total × (rate / (100 + rate)) */ static calculateTaxFromInclusive(total: string, percentage: number): string; /** * Calculate subtotal from tax-inclusive total * Formula: subtotal = total - tax */ static calculateSubtotalFromInclusive(total: string, percentage: number): string; /** * Calculate tax amount for a single invoice item * Formula: tax = amount × (rate / 100) */ static calculateTaxForItem(amount: string, percentage: number): string; /** * Calculate total tax for multiple invoice items */ static calculateTotalTax(items: Array<{ amount: string; tax_rate_id?: string; tax_rate?: { percentage: number; }; }>): string; } export type TTaxRate = InferAttributes;