import ValidableInterface from '../../common/interfaces/ValidableInterface'; import BaseEntity from '../../common/entities/BaseEntity'; import TravelStop from '../../TravelStop/entity/TravelStop'; export default class TravelStopPricing extends BaseEntity implements ValidableInterface { private _destination_stop: TravelStop; private _one_leg_price: number; private _two_legs_price: number; // TODO: Implement currency -> ISO (EUR), symbol (€), symbol position (left, right), decimal precision (number). // TODO: Implement money -> amount (number), currency. get destination_stop(): TravelStop { return this._destination_stop; } set destination_stop(value: TravelStop) { this._destination_stop = value; } get one_leg_price(): number { return this._one_leg_price; } set one_leg_price(value: number) { this._one_leg_price = value; } get two_legs_price(): number { return this._two_legs_price; } set two_legs_price(value: number) { this._two_legs_price = value; } public calculatePriceByPrecision(amount, precision) { return amount / (10 * precision); } invalidFields(prefix: string = ''): Array { let fields = []; return fields; } isValid(): Boolean { return this.invalidFields().length === 0; } isValidCombination(fromPickup: TravelStop): boolean { return fromPickup.isPickup() && this.destination_stop.isDropoff() && !fromPickup.isEqual(this.destination_stop); } }