UNPKG

patrimoniumjs

Version:

Patrimonium.js is a JavaScript library providing a set of tools to modelize the real estate operations of an individual and their impact on the financial situation of the same individual.

76 lines (75 loc) 3.52 kB
import { PropertyImprovement, PropertySale, PropertyMove, PropertyRentOut, PropertyPurchase, LoanOptions, Rental, PersonInitialSituation, SimpleDate, PersonSituation, History } from "."; /** * Represents a person. */ export declare class Person { protected readonly _initialSituation: PersonSituation; /** * The actions taken by the `Person` over time. */ private readonly _actions; /** * Returns a new instance of a `Person`. * @param initialSituation The initial situation of the `Person` including his assets, liabilities, salary etc. */ constructor(initialSituation?: PersonInitialSituation); /** * Returns the financial reporting history of a `Person` up to a specific date. * @param dateUntil Returns only reports until this date. * @example * const person = new Person(); * const sixMonthsLater = new SimpleDate({ nthMonth: 6 }); * const oneYearLater = new SimpleDate({ nthMonth: 12 }); * const history = person.getHistory(oneYearLater); * const balanceSheetOneYearLater = history.getReporting(oneYearLater).balanceSheet; * const plStatementSixMonthsLater = history.getReporting(sixMonthsLater).plStatement; */ getHistory(dateUntil: SimpleDate): History; /** * Performs the action of buying a property on behalf of this `Person` instance. * @param date The purchase date. * @param purchase The purchase details. */ buyProperty(date: SimpleDate, purchase: PropertyPurchase): void; /** * Performs the action of signing a loan on behalf of this `Person` instance. * @param date The loan signature date. * @param loan The loan details. */ signLoan(date: SimpleDate, loan: LoanOptions): void; /** * Performs the action of selling a property on behalf of this `Person` instance. * @param date The sale date. * @param sale The sale details. If not provided, the first acquired property is sold. */ sellProperty(date: SimpleDate, sale?: PropertySale): void; /** * Performs the action of renting a property on behalf of this `Person` instance. * @param date The start date of the rental. * @param rental The rental details. */ rentProperty(date: SimpleDate, rental: Rental): void; /** * Performs the action of leaving a rental property on behalf of this `Person` instance. * @param date The date of the leave. */ leaveRentalProperty(date: SimpleDate): void; /** * Performs the action of moving in a property on behalf of this `Person` instance. * @param date The date of the move. * @param move The move details. If not provided, the `Person` movies in the first acquired property. */ moveIn(date: SimpleDate, move?: PropertyMove): void; /** * Performs the action of making a property improvement on behalf of this `Person` instance. * @param date The date of the property improvement. * @param improvement The property improvement details. */ makePropertyImprovement(date: SimpleDate, improvement: PropertyImprovement): void; /** * Performs the action of renting out a property on behalf of this `Person` instance. * @param date The start date of the rent. * @param rent The rent details. If not provided, the first acquired property is rented out. */ rentOutProperty(date: SimpleDate, rent?: PropertyRentOut): void; }