/** * Calculates the maximum purchase price (and other variables) for a property a person can afford and the related mortgage it would qualify for based on annual income, down payment, mortgage interest rate, and additional options. * * @example * Basic usage * ```ts * // With an annual income of $100,000, a down payment of $25,000, and a rate of 5.25%. * const results = maxMortgageAmount(100_000, 25_000, 5.25) * // returns... * // { * // annualIncome: 100000, * // downPayment: 25000, * // rate: 5.25, * // rateTested: 7.25, * // purchasePrice: 307000, * // mortgageAmount: 293280, * // insurancePremium: 11280, * // monthlyMortgagePayment: 2099.65, * // grossDebtServiceRatio: 0.32, * // totalDebtServiceRatio: 0.32, * // reason: "debt limit", * // monthlyDebtPayment: 0, * // monthlyHeating: 175, * // isHeatingEstimate: true, * // monthlyTax: 385, * // isTaxEstimate: true, * // monthlyCondoFees: 0, * // } * ``` * * @param annualIncome - The annual income of the borrower. * @param downPayment - The amount of money paid upfront. * @param rate - The mortgage interest rate. * @param options - Additional options such. * @param options.monthlyDebtPayment - The monthly debt payment of the borrower. Defaults to 0. * @param options.monthlyHeating - The monthly heating cost. Defaults to $175. * @param options.monthlyTax - The monthly property tax. Default to 1.5% of the purchase price. * @param options.monthlyCondoFees - The monthly condo fees. Defaults to 0. * * @category Finance **/ export default function mortgageMaxAmount(annualIncome: number, downPayment: number, rate: number, options?: { monthlyDebtPayment?: number; monthlyHeating?: number; monthlyTax?: number; monthlyCondoFees?: number; }): { annualIncome: number; downPayment: number; rate: number; rateTested: number; purchasePrice: number; mortgageAmount: number; insurancePremium: number; monthlyMortgagePayment: number; grossDebtServiceRatio: number; totalDebtServiceRatio: number; reason: string; monthlyDebtPayment: number; monthlyHeating: number; isHeatingEstimate: boolean; monthlyTax: number; isTaxEstimate: boolean; monthlyCondoFees: number; };