import { buildDefaultHeroTabs } from "./buildDefaultHeroTabs";

export type HeroTabTrait = {
  trait: string;
  pct: number;
};

export type HeroTabTraitGroup = {
  mindset: string;
  traits: HeroTabTrait[];
};

export type HeroTabCourse = {
  name: string;
  emoji: string;
  slug: string;
  href: string;
  pct: number;
};

export type HeroTabCourseGroup = {
  category: string;
  courses: HeroTabCourse[];
};

export type HeroTabPosition = {
  desktop: string;
  mobileOrder: number;
};

export type HeroTab = {
  key: string;
  title: string;
  emoji: string;
  color: string;
  desc: string;
  buttonLabel: string;
  iconSrc: string;
  position: HeroTabPosition;
  traitGroups: HeroTabTraitGroup[];
  courseGroups: HeroTabCourseGroup[];
};

/** @deprecated Legacy field name — migrated to `tabs` on load. */
export type HeroDimensionContent = Pick<
  HeroTab,
  "key" | "title" | "emoji" | "color" | "desc" | "buttonLabel"
>;

export type HeroContent = {
  __required?: string[];
  __fieldLabels?: Record<string, string>;
  logo: { src: string; alt: string };
  title: string;
  subtitle: string;
  horseImage: { src: string; alt: string };
  tabs: HeroTab[];
  detailPanel: {
    traitsSectionTitle: string;
    coursesSectionTitle: string;
    emptyCoursesMessage: string;
  };
};

export const defaultHeroFieldLabels: Record<string, string> = {
  tabs: "Interactive Tabs",
  buttonLabel: "Label Around Image",
  iconSrc: "Tab Icon / Image URL",
  traitGroups: "Character Traits",
  courseGroups: "Courses",
  mindset: "Mindset Group",
  traits: "Traits",
  category: "Course Category",
  courses: "Course Cards",
  pct: "Percentage",
  position: "Tab Position",
  desktop: "Desktop Position (CSS classes)",
  mobileOrder: "Mobile Order",
};

export const defaultHeroContent: HeroContent = {
  __required: ["title"],
  __fieldLabels: defaultHeroFieldLabels,
  logo: {
    src: "",
    alt: "Orion STEM Schools",
  },
  title: "Light the World.",
  subtitle: "Click any attribute to explore character traits, mindsets, and courses behind it.",
  horseImage: {
    src: "",
    alt: "SPARK — Orion's horse mascot with Portrait of the Learner attributes",
  },
  tabs: buildDefaultHeroTabs(),
  detailPanel: {
    traitsSectionTitle: "Character Traits & Mindsets",
    coursesSectionTitle: "Courses at Orion",
    emptyCoursesMessage: "No course data available for this dimension yet.",
  },
};
