export type ScheduleScope = "project" | "global";
export type ScheduleStatus = "pending" | "done" | "cancelled" | "snoozed";
export type ScheduleKind =
	| "reminder"
	| "milestone_check"
	| "review_due"
	| "recurring"
	| "review"
	| "audit"
	| "prompt"
	| "command";

export interface ScheduleEntry {
	id: string;
	kind: ScheduleKind;
	status: ScheduleStatus;
	due_at: string;
	created_at: string;
	payload: Record<string, unknown>;
	created_by: "agent" | "user" | "system";
	autonomous_dispatch?: boolean;
	snoozed_at?: string;
}

export interface ScheduleStore {
	appendEntry(scope: ScheduleScope, entry: ScheduleEntry): void;
	readEntries(scope: ScheduleScope): ScheduleEntry[];
	findDue(scope: ScheduleScope, now: string | number | Date): ScheduleEntry[];
	findUpcoming(
		scope: ScheduleScope,
		now: string | number | Date,
		windowDays: number,
	): ScheduleEntry[];
	_filePathForScope(scope: ScheduleScope): string;
}

export function createScheduleStore(basePath: string): ScheduleStore;
export function resolveSchedulePath(
	basePath: string,
	scope: ScheduleScope,
): string;
