import ICalendarBase from './types/ICalendarBase' ; import CalendarRecurrence from './types/CalendarRecurrence' ; import CalendarOptions from './types/CalendarOptions' ; import time from './utils/time' ; import CalendarAttendee from './types/CalendarAttendee' ; /**
 * Base calendar class. This class can be extended to add new calendar services.
 */ abstract class CalendarBase implements ICalendarBase { /** True if the event is one that spans the entire day. */ protected isAllDay = false ; /** Event description. */ protected description = '' ; /** Event title. */ protected title = '' ; /** Event physical location. */ protected location = '' ; /** Start time of the event. */ protected start = new Date ( ) ; /** End time of the event. */ protected end = new Date ( ) ; /** Event recurrence specification. See  CalendarRecurrence protected recurrence ? : CalendarRecurrence ; /** Calendar service query string params. */ protected params : Record < string , string | null > = { } ; /** Array of event attendees. See  CalendarAttendee protected attendees : CalendarAttendee [ ] = [ ] ; param { CalendarOptions } options constructor ( options ) { this . setText ( options ) ; this . setTimestamps ( options ) ; this . setAttendees ( options ) ; } param { CalendarOptions } options protected setText = ( options ) : void => { this . description = options . description || '' ; this . title = options . title || '' ; this . location = options . location || '' ; } ; param { CalendarOptions } options protected setTimestamps = ( options ) : void => { this . isAllDay = ! options . end ; this . start = options . start ; this . end = options . end || time . incrementDate ( this . start , 1 ) ; this . recurrence = options . recurrence ; } ; param { CalendarOptions } options protected setAttendees ( options ) { this . attendees = Array . isArray ( options . attendees ) ? options . attendees : [ ] ; } param { string } key param { string | null } value returns { CalendarBase } public setParam = ( key , value ) : this => { this . params [ key ] = value ; return this ; } ; /** Sets base query string/ICS params. */ protected abstract setInitialParams ( ) ; /** Renders the URL/ICS file data. */ public abstract render ( ) ; } export default CalendarBase ;