import { StampDutyRatesByTaxType, Country, CountriesWithRatesByTaxTypes } from '../../api/models/stamp-duty-rates.types'; import { SerializableStampDutyRate } from '../../serializers'; export type UseStampDutyCalculatorResult = { handleChangeCalculationValue: (e: React.ChangeEvent) => void; calculationValue: number; firstTimeBuyer: boolean; setFirstTimeBuyer: (value: boolean) => void; country: string; updateCountry: (value: Country) => void; additionalProperty: boolean; setAdditionalProperty: (value: boolean) => void; resident: boolean; setResident: (value: boolean) => void; stampDutyData: StampDutyCalculationResult | null; }; /** * Used to create a stamp duty calculator. Returns * `handleChangeCalculationValue` callback for text input change containing calculation value * `calculationValue` the current value the stamp duty calculator is working with * `firstTimeBuyer` the current value of if the buyer is a first time buyer or not * `setFirstTimeBuyer` a function to set the status of firstTimeBuyer called with either `true` or `false` * `country` the current value of which juristictions rates should be used for calculations * `setCountry` a function to set the juristiction called with either `english`, 'welsh` or `scottish` * `additionalProperty` the current value of if the buyer is buying a second home * `setAdditionalProperty` a function to set the status of additionalProperty called with either `true` or `false` * `resident` the current value of if the buyer is resident of the country in question * `setResident` a function to set the status of resident called with either `true` or `false` * `stampDuty` results of the stamp duty calculation in the format of StampDutyCalculationResult * * @example * ```tsx * const { handleChangeOrder, sortOptions, sorting } = useSortOrder(); * const { * handleChangeCalculationValue, * setAdditionalProperty, * additionalProperty, * calculationValue, * stampDuty, * } = useStampDutyCalculator({}); * * return ( * *
* {'Property Value: '} * *
*
* Stamp Duty: £{stampDuty.total.toLocaleString()} *
* ) * ``` */ type Band = { lower: number | null; upper: number | null; rate: number; minimumThreshold?: number; }; type BandCalculation = Band & { stampDutyPortion: number; }; type StampDutyCalculationResult = { bands: BandCalculation[]; total: number; effectiveRate: number; }; export type UseStampDutyCalculatorProps = { calculationValue?: number; firstTimeBuyer?: boolean; isCompany?: boolean; country?: Country; additionalProperty?: boolean; resident?: boolean; rates: StampDutyRatesByTaxType | CountriesWithRatesByTaxTypes | null; }; export declare const getPriceBracketIndex: (price: number, arr: SerializableStampDutyRate[]) => number | null; export default function useStampDutyCalculator({ calculationValue: defaultCalculationValue, firstTimeBuyer: defaultFirstTimeBuyer, country: defaultCountry, additionalProperty: defaultAdditionalProperty, isCompany: defaultIsCompany, resident: defaultResident, rates, }: UseStampDutyCalculatorProps): UseStampDutyCalculatorResult; export {}; //# sourceMappingURL=use-stamp-duty-calculator.d.ts.map