// Simple { label, value } pair used by the dashboard dropdowns.
export type CdcGpsfDashboardOption = {
  label: string;
  value: string;
};

// What the user has picked in the filter bar. The id-based fields hold the
// database id as a string (e.g. "3"), or "" meaning "show everything".
export type CdcGpsfDashboardFiltersValue = {
  workingGroup: string; // stakeholder id of the working group, or ""
  status: string; // issue status id, or ""
  agency: string; // primary agency stakeholder id, or ""
  category: string; // category id, or ""
  year: string; // "2026" etc., or "" for all years
  report: string[]; // visual only for now — the backend has no report filter
};

// Default = no filters, so the first load shows every issue. (Issues are
// created in the current year, so defaulting to an old year like "2018"
// would make the dashboard look empty.)
export const defaultCdcGpsfDashboardFilters: CdcGpsfDashboardFiltersValue = {
  workingGroup: "",
  status: "",
  agency: "",
  category: "",
  year: "",
  report: [],
};

const FIRST_DASHBOARD_YEAR = 2018;

// "All years" first, then 2018 up to the current year.
export const cdcGpsfYearOptions: CdcGpsfDashboardOption[] = [
  { label: "All years", value: "" },
  ...Array.from(
    { length: new Date().getFullYear() - FIRST_DASHBOARD_YEAR + 1 },
    (_, index) => {
      const year = String(FIRST_DASHBOARD_YEAR + index);
      return { label: year, value: year };
    },
  ),
];

// Progress report options (kept from the design; not sent to the backend).
export const cdcGpsfReportOptions: CdcGpsfDashboardOption[] = [
  { label: "Both", value: "both" },
  { label: "S1", value: "s1" },
  { label: "S2", value: "s2" },
];
