import { OptionalNullable } from '@humand-packages/common';

export class TimeSlotIsoDatetime {
    constructor(startTime: string, endTime: string) {
        if (isNaN(Date.parse(startTime)) || isNaN(Date.parse(endTime))) {
            throw new Error('startTime and endTime must be valid ISO datetime strings');
        }
        this.startTime = startTime;
        this.endTime = endTime;
    }

    startTime!: string;
    endTime!: string;
}

export class TimeTrackingNotificationScheduleItem {
    constructor(dateString: string, timeSlots: TimeSlotIsoDatetime[], showNotifications: boolean) {
        this.dateString = dateString;
        this.timeSlots = timeSlots;
        this.showNotifications = showNotifications;
    }

    dateString!: string;
    timeSlots!: TimeSlotIsoDatetime[];
    showNotifications!: boolean;
}

export class TimeTrackingNotificationSchedule {
    constructor(properties: OptionalNullable<TimeTrackingNotificationSchedule>) {
        Object.assign(this, properties);
    }

    schedules!: TimeTrackingNotificationScheduleItem[];
}
