Organize/types/scheduled-todo.ts

53 lines
1.9 KiB
TypeScript

import type { RecurrenceInput } from "@/lib/validation/scheduled-todo";
/** One calendar occurrence of a ScheduledTodo -- a recurring to-do produces
* many of these, one per matching date, each independently completable. */
export interface ScheduledOccurrenceDTO {
scheduledTodoId: string;
title: string;
details: string | null;
// "YYYY-MM-DD"
occurrenceDate: string;
completed: boolean;
isRecurring: boolean;
// "HH:MM" (24-hour), or null if this to-do has no specific time due.
// See lib/time-of-day.ts -- comparing it to "now" is a client-only concern.
timeDue: string | null;
// Minutes of lead time before timeDue to notify at, null = no reminder.
// Only meaningful when timeDue is set. See lib/time-of-day.ts's
// REMIND_OPTIONS for the selectable values.
remindMinutesBefore: number | null;
}
export interface ScheduledDayDTO {
// "YYYY-MM-DD"
date: string;
occurrences: ScheduledOccurrenceDTO[];
}
/** Shape the Scheduled panel renders directly. */
export interface ScheduledBoardDTO {
// Missed occurrences from the last 30 days, oldest first. Empty when
// there's nothing outstanding -- the panel renders nothing for it then.
overdue: ScheduledOccurrenceDTO[];
today: ScheduledDayDTO;
// Tomorrow through Sunday of the current week, always one entry per day
// (even if empty) so the panel can render every remaining day's header.
upcoming: ScheduledDayDTO[];
}
/** The raw to-do, for the edit dialog -- distinct from ScheduledOccurrenceDTO,
* which is one date's occurrence rather than the whole series. */
export interface ScheduledTodoEditDTO {
id: string;
title: string;
details: string | null;
// "YYYY-MM-DD"
startDate: string;
recurrence: RecurrenceInput | null;
// "HH:MM" (24-hour), or null if this to-do has no specific time due.
timeDue: string | null;
// Minutes of lead time before timeDue to notify at, null = no reminder.
remindMinutesBefore: number | null;
}