import type { DateLocalizer } from "react-big-calendar";

/** The shapes the calendar screen is built around. */

/**
 * What `useCalendar` hangs off each react-big-calendar event.
 *
 * `id` and `status` are carried but **not read anywhere today** — grepping
 * `resource.id` and `resource.status` across `src` finds no consumer; only
 * `color`, `desc` and `detailPath` are rendered. They are kept because the
 * detail navigation will need the id, and their declared types are corrected
 * here rather than coerced at the one assignment: `id` is the opportunity's
 * integer id (it was declared `string` while a number was assigned, which only
 * went unnoticed because the payload was `any`), and `opportunity_status` is
 * explicitly nullable on the calendar payload.
 *
 * `id` is not unique on its own — see `calendarEntryKey`.
 */
export interface EventResource {
  color: string;
  desc: string;
  type: string;
  detailPath: string;
  status: string | null;
  id: number;
}

export interface CalendarEvent {
  title: string;
  start: Date;
  end: Date;
  allDay: boolean;
  resource: EventResource;
}

export interface DayWithEvent {
  date: string;
  color: string;
}

export interface MiniCalendarDate {
  day: number | null;
  date: string | null;
  isCurrentMonth: boolean;
  isToday?: boolean;
  events?: DayWithEvent[];
}

export interface Task {
  title: string;
  time: string;
  category: string;
  date?: string;
}

export type CustomView = "day" | "week" | "month" | "year";

/** Header props shared by the month and day header cells. */
export interface CustomMonthHeaderProps {
  date: Date;
  label: string;
  isRTL?: boolean;
}

export interface YearViewProps {
  date: Date;
  localizer: DateLocalizer;
  events: CalendarEvent[];
  onNavigate: (date: Date) => void;
  isRTL: boolean;
}

export interface YearViewDay {
  day: number | null;
  date: string | null;
  isToday?: boolean;
  events?: CalendarEvent[];
}
