import type { Weekday } from './Weekday'; import { weekdayToIndex } from './Weekday'; export class WeekdaySet { private readonly days: Weekday[]; constructor(days: Weekday[]) { if (!Array.isArray(days) || days.length === 0) { throw new Error('WeekdaySet requires at least one weekday'); } const unique = Array.from(new Set(days)); this.days = unique.sort((a, b) => weekdayToIndex(a) - weekdayToIndex(b)); } getAll(): Weekday[] { return [...this.days]; } includes(day: Weekday): boolean { return this.days.includes(day); } }