import ReservationPriceCalculationRequest from '../api/reservation-price-calculation-request'; import { ReservationSaveRequest } from '../api/reservation-save-request'; import Contact from './contact'; import Lead from './lead'; import Resource from './resource'; import SObject, { CustomSFSObject } from './s-object'; import Service from './service'; import ServiceReservation from './service-reservation'; export default class Reservation extends SObject { private startDatetime; private endDatetime; private resource; private contact; private lead; serviceReservations: ServiceReservation[]; /** * Attatch this reservation to the given resource. * * @param resource The resource to attatch this reservation to. * @returns This reservation */ setResource(resource: Resource): Reservation; /** * Get the resource this reservation is currently attatched to. * * @returns The resource this reservation is attached to. */ getResource(): Resource | null; /** * @param datetime The start datetime to set on the reservation (GMT) * @returns This reservation */ setStartDatetime(datetime: Date): Reservation; /** * Get the reservation start date time. * * @returns This reservation startDatetime */ getStartDatetime(): Date | null; /** * @param datetime The end datetime to set on the reservation (GMT) * @returns This reservation */ setEndDatetime(datetime: Date): Reservation; /** * Get the reservation end date time. * * @returns This reservation endDatetime */ getEndDatetime(): Date | null; /** * Sets a contact to be attached to this reservation. This contact will either be linked through reservation contact or through the contact lookup. * This can be configured in salesforce. The contact will be duplicate checked and the existing contact will be linked instead if already found. * * @param contact The contact to attach to the reservation * @returns This reservation */ setContact(contact: Contact): Reservation; /** * Sets a lead to be attached to this reservation. This lead will be linked through the lead lookup. * The lead will be duplicate checked and the existing lead will be linked instead if already found. * * @param lead The lead to attach to the reservation * @returns This reservation */ setLead(lead: Lead): Reservation; /** * Creates a service reservation and attaches it to the reservation. * * @param service The service to reserve * @param quantity The quantity to reserve * @returns The service reservation created. */ addService(service: Service, quantity: number): ServiceReservation; /** * @internal * @returns Save request data for this reservation */ getReservationSaveRequest(): ReservationSaveRequest; /** * @internal * @returns Price calculation request data for this reservation */ getPriceCalculationData(): ReservationPriceCalculationRequest; /** * @internal * @returns The Salesforce formatted data for the reservation */ getSFSObject(): Partial; /** * @internal * @returns The Salesforce formatted data for the lead */ private getLead; /** * @internal * @returns The Salesforce formatted data for the contact */ private getContact; /** * @internal * @returns The Salesforce formatted data for the servuce reservations */ private getServiceReservationRestData; /** * @internal * @returns A string representing the startdatetime */ private getStartDatetimeString; /** * @internal * @returns A string representing the enddatetime */ private getEndDatetimeString; } interface SFReservation extends CustomSFSObject { B25__ABRCompositeKey__c?: string | null; B25__ABRSerialNr__c?: number | null; B25__ABRSerialPartNr__c?: number | null; B25__Account__c?: string | null; B25__Additional_Attendees__c?: string | null; B25__Additional_Google_Data__c?: string | null; B25__Additional_Outlook_Data__c?: string | null; B25__AutomatedBookingRule__c?: string | null; B25__Base_Price__c?: number | null; B25__Calculation_Method__c?: string | null; B25__Contact__c?: string | null; B25__End__c?: string | null; B25__End_Buffer_Duration__c?: number | null; B25__End_Date__c?: string | null; B25__End_GMT__c?: string | null; B25__End_Local_DateTime__c?: string | null; B25__EndLocal__c?: string | null; B25__Event_Id__c?: string | null; B25__Google_Id__c?: string | null; B25__Group__c?: string | null; B25__Has_Conflicts__c?: boolean | null; B25__Has_Resource_Conflicts__c?: boolean | null; B25__Has_Staff_Conflicts__c?: boolean | null; B25__Hover__c?: string | null; B25__Info__c?: string | null; B25__IsUnassigned__c?: boolean | null; B25__Lead__c?: string | null; B25__Local_End_Time__c?: string | null; B25__Local_Start_Time__c?: string | null; B25__MaxCapacity__c?: number | null; B25__Notes__c?: string | null; B25__Opportunity__c?: string | null; B25__OpportunityLineItem__c?: string | null; B25__Outlook_Series_Master_Id__c?: string | null; B25__Price__c?: number | null; B25__Quantity__c?: number | null; B25__Recurring_Reservation__c?: string | null; B25__Reservation_Template__c?: string | null; B25__Reservation_Type__c?: string | null; B25__Resource__c?: string | null; B25__ResourceName__c?: string | null; B25__ResourceTimezone__c?: string | null; B25__Sample_Custom_Field__c?: string | null; B25__SelectedLayout__c?: string | null; B25__SelectedTimeframe__c?: string | null; B25__Service_Costs__c?: number | null; B25__Skip_Subtotal_Calculation__c?: boolean | null; B25__Staff__c?: string | null; B25__Start__c?: string | null; B25__Start_Buffer_Duration__c?: number | null; B25__Start_Date__c?: string | null; B25__Start_GMT__c?: string | null; B25__Start_Local_DateTime__c?: string | null; B25__StartLocal__c?: string | null; B25__Status__c?: string | null; B25__Subtotal__c?: number | null; B25__Title__c?: string | null; B25__Total_Price__c?: number | null; B25__Unique_Outlook_Id__c?: string | null; B25__User__c?: string | null; B25__Visit__c?: string | null; B25__What_Is_This__c?: string | null; } export { SFReservation };