import BaseEntity from '../../common/entities/BaseEntity'; import ValidableInterface from '../../common/interfaces/ValidableInterface'; import Journey from '../../Journey/entity/Journey'; import Product from '../../Product/entity/Product'; import PassengerType from '../../PassengerType/entity/PassengerType'; import Stop from '../../Stop/entity/Stop'; type legsShape = { pickup: Stop, dropoff: Stop }; type passengerTypeShape = { passenger_type: PassengerType, number_of_seats: number }; export default class Booking extends BaseEntity implements ValidableInterface { protected _journey: Journey; protected _event_product: Product; protected _date: string; protected _legs: Array = []; protected _original_price: number; protected _paid_amount: number; protected _number_of_passengers: Array = []; get journey(): Journey { return this._journey; } set journey(value: Journey) { this._journey = value; } get event_product(): Product { return this._event_product; } set event_product(value: Product) { this._event_product = value; } get date(): string { return this._date; } set date(value: string) { this._date = value; } get legs(): Array { return this._legs; } set legs(value: Array) { this._legs = value; } get original_price(): number{ return this._original_price; } set original_price(value: number) { this._original_price = value; } get paid_amount(): number{ return this._paid_amount; } set paid_amount(value: number) { this._paid_amount = value; } get number_of_passengers(): Array { return this._number_of_passengers; } set number_of_passengers(value: Array) { this._number_of_passengers = value; } isValid(): boolean { return this.invalidFields().length === 0; } invalidFields() { let fields = []; // !this.name && fields.push('name'); // !this.city_name && fields.push('city_name'); // !this.address && fields.push('address'); // !this.latitude && fields.push('latitude'); // !this.longitude && fields.push('longitude'); // !this.administrative_authority_id && fields.push('administrative_authority_id'); // !this.city_full_name && fields.push('city_full_name'); // !this.driver_description && fields.push('driver_description'); // !this.passenger_description && fields.push('passenger_description'); return fields; } }