export type TableRow = string[];

export type PCOStyle = {
  backgroundColor?: string;
  textColor?: string;
  borderColor?: string;
  titleColor?: string;
  subtitleColor?: string;
  mutedTextColor?: string;
  cardBackgroundColor?: string;
  cardBorderColor?: string;
  cardTextColor?: string;
  padding?: string;
  icon?: string;
  imageUrl?: string;
  /** Hero gradient stops (used when backgroundColor is not set). */
  heroGradientStart?: string;
  heroGradientMid?: string;
  heroGradientEnd?: string;
  eyebrowColor?: string;
  tableHeaderBackgroundColor?: string;
  tableHeaderTextColor?: string;
  tableRowAltBackgroundColor?: string;
  tableCellTextColor?: string;
  tableBorderColor?: string;
  sectionNumberColor?: string;
  sectionTitleBorderColor?: string;
  pillBackgroundColor?: string;
  pillTextColor?: string;
  learnerItemBackgroundColor?: string;
  learnerItemTextColor?: string;
  learnerItemDetailColor?: string;
  learnerItemAccentColor?: string;
  learnerItemBorderColor?: string;
  docBackgroundColor?: string;
  docBorderColor?: string;
  themeNavy?: string;
  themeTeal?: string;
  themeSky?: string;
  themeGold?: string;
  themeInk?: string;
  themeMuted?: string;
  themeLine?: string;
  themePaper?: string;
  themeBg?: string;
  themeSoft?: string;
  chartGridColor?: string;
  chartAxisColor?: string;
  chartFillColor?: string;
  chartStrokeColor?: string;
  chartLabelColor?: string;
  chartPointColor?: string;
};

export type LearnerCanItem = {
  text: string;
  detail?: string;
  icon?: string;
  backgroundColor?: string;
  textColor?: string;
  borderColor?: string;
};

export type PCOSectionType =
  | "promise-snapshot"
  | "text"
  | "portrait-spider"
  | "table"
  | "learner-list"
  | "related"
  | "home-support";

export type PCOSection = {
  id: string;
  type: PCOSectionType;
  enabled: boolean;
  number?: string;
  title: string;
  body?: string;
  bodySecondary?: string;
  relatedSuffix?: string;
  tableHeaders?: string[];
  tableRows?: TableRow[];
  learnerItems?: LearnerCanItem[];
  portraitLabels?: string[];
  portraitScores?: number[];
  portraitSubtitle?: string;
  portraitNote?: string;
  style?: PCOStyle;
};

export type PCOHero = {
  eyebrow?: string;
  course?: string;
  promise?: string;
  gradeBand?: string;
  style?: PCOStyle;
};

export type PCOFooter = {
  text?: string;
  style?: PCOStyle;
};

export type ParentCourseOverviewContent = {
  cardColor?: string;
  cardBorderColor?: string;
  globalStyle?: PCOStyle;
  hero?: PCOHero;
  sections?: PCOSection[];
  footer?: PCOFooter;
  /** @deprecated Legacy flat fields — migrated to sections on load */
  gradeBand?: string;
  course?: string;
  subject?: string;
  promise?: string;
  prereq?: string;
  focus?: string;
  why?: string;
  differentiator?: string;
  connectionsOther?: string;
  connectionsAdds?: string;
  learnerICan?: LearnerCanItem[] | string[];
  gain?: string;
  create?: string;
  journey?: TableRow[];
  across?: TableRow[];
  assessment?: string;
  assessmentRows?: TableRow[];
  coverage?: TableRow[];
  portraitText?: TableRow[];
  portraitScores?: number[];
  portraitLabels?: string[];
  related?: string;
  home?: string;
  growth?: string;
  footerNote?: string;
  portraitNote?: string;
};

export type ParsedParentCourseOverview = {
  cardColor: string;
  cardBorderColor: string;
  globalStyle: PCOStyle;
  hero: Required<Pick<PCOHero, "eyebrow" | "course" | "promise" | "gradeBand">> & { style: PCOStyle };
  sections: PCOSection[];
  footer: Required<Pick<PCOFooter, "text">> & { style: PCOStyle };
};
