// Portrait of the Learner — Mindset & Character Trait Mapping
// Extracted from Orion STEM Schools PoL framework

export interface TraitMapping {
  mindset: string;
  trait: string;
  boldVisionaryLeader: number;
  balancedPerson: number;
  inspiringCommunicator: number;
  resilientProblemSolver: number;
  respectfulRelationshipBuilder: number;
  caringCitizen: number;
}

export interface PortraitDimension {
  key: string;
  title: string;
  emoji: string;
  color: string;
  desc: string;
}

export const portraitDimensions: PortraitDimension[] = [
  { key: "boldVisionaryLeader", title: "Bold Visionary Leader", emoji: "🚀", color: "valencia", desc: "Takes initiative, imagines possibilities, leads with purpose" },
  { key: "balancedPerson", title: "Balanced Person", emoji: "⚖️", color: "sunflower", desc: "Manages emotions, maintains well-being, approaches challenges with self-awareness" },
  { key: "inspiringCommunicator", title: "Inspiring Communicator", emoji: "💬", color: "deep-sea", desc: "Expresses ideas clearly, listens actively, presents with confidence" },
  { key: "resilientProblemSolver", title: "Resilient Problem Solver", emoji: "💪", color: "moss", desc: "Persists through challenges, learns from failure, embraces grit" },
  { key: "respectfulRelationshipBuilder", title: "Respectful Relationship Builder", emoji: "🤝", color: "mist", desc: "Collaborates effectively, values diverse perspectives" },
  { key: "caringCitizen", title: "Caring Citizen", emoji: "🌍", color: "salmon", desc: "Acts responsibly toward community and environment" },
];

export const traitMappings: TraitMapping[] = [
  { mindset: "Being in the Here & Now", trait: "Gratitude", boldVisionaryLeader: 0, balancedPerson: 50, inspiringCommunicator: 0, resilientProblemSolver: 0, respectfulRelationshipBuilder: 30, caringCitizen: 20 },
  { mindset: "Belonging", trait: "Social Intelligence", boldVisionaryLeader: 0, balancedPerson: 20, inspiringCommunicator: 30, resilientProblemSolver: 0, respectfulRelationshipBuilder: 50, caringCitizen: 0 },
  { mindset: "Belonging", trait: "Caring", boldVisionaryLeader: 0, balancedPerson: 0, inspiringCommunicator: 0, resilientProblemSolver: 0, respectfulRelationshipBuilder: 20, caringCitizen: 80 },
  { mindset: "Belonging", trait: "Kindness", boldVisionaryLeader: 0, balancedPerson: 0, inspiringCommunicator: 0, resilientProblemSolver: 10, respectfulRelationshipBuilder: 70, caringCitizen: 20 },
  { mindset: "Acceptance", trait: "Emotional Intelligence", boldVisionaryLeader: 20, balancedPerson: 40, inspiringCommunicator: 20, resilientProblemSolver: 0, respectfulRelationshipBuilder: 20, caringCitizen: 0 },
  { mindset: "Acceptance", trait: "Intellectual Humility", boldVisionaryLeader: 20, balancedPerson: 40, inspiringCommunicator: 0, resilientProblemSolver: 0, respectfulRelationshipBuilder: 40, caringCitizen: 0 },
  { mindset: "Acceptance", trait: "Self-Control", boldVisionaryLeader: 0, balancedPerson: 100, inspiringCommunicator: 0, resilientProblemSolver: 0, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Believing", trait: "Self-Efficacy", boldVisionaryLeader: 30, balancedPerson: 10, inspiringCommunicator: 20, resilientProblemSolver: 40, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Believing", trait: "Personal Mastery", boldVisionaryLeader: 0, balancedPerson: 100, inspiringCommunicator: 0, resilientProblemSolver: 0, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Believing", trait: "Honesty", boldVisionaryLeader: 0, balancedPerson: 30, inspiringCommunicator: 0, resilientProblemSolver: 0, respectfulRelationshipBuilder: 30, caringCitizen: 40 },
  { mindset: "Believing", trait: "Courage", boldVisionaryLeader: 100, balancedPerson: 0, inspiringCommunicator: 0, resilientProblemSolver: 0, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Believing", trait: "Ethics", boldVisionaryLeader: 30, balancedPerson: 30, inspiringCommunicator: 0, resilientProblemSolver: 0, respectfulRelationshipBuilder: 0, caringCitizen: 40 },
  { mindset: "Big Dreams", trait: "Purpose", boldVisionaryLeader: 60, balancedPerson: 40, inspiringCommunicator: 0, resilientProblemSolver: 0, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Big Dreams", trait: "Curiosity", boldVisionaryLeader: 20, balancedPerson: 0, inspiringCommunicator: 20, resilientProblemSolver: 60, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Big Dreams", trait: "Creativity", boldVisionaryLeader: 30, balancedPerson: 0, inspiringCommunicator: 30, resilientProblemSolver: 40, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Big Dreams", trait: "Proactivity", boldVisionaryLeader: 80, balancedPerson: 0, inspiringCommunicator: 0, resilientProblemSolver: 20, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Change", trait: "Judgment", boldVisionaryLeader: 50, balancedPerson: 40, inspiringCommunicator: 0, resilientProblemSolver: 10, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Change", trait: "Decision Making", boldVisionaryLeader: 50, balancedPerson: 30, inspiringCommunicator: 0, resilientProblemSolver: 20, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Change", trait: "Grit", boldVisionaryLeader: 0, balancedPerson: 0, inspiringCommunicator: 0, resilientProblemSolver: 100, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
  { mindset: "Change", trait: "Growth Mindset", boldVisionaryLeader: 0, balancedPerson: 60, inspiringCommunicator: 0, resilientProblemSolver: 40, respectfulRelationshipBuilder: 0, caringCitizen: 0 },
];

// Get traits relevant to a specific PoL dimension
export const getTraitsForDimension = (dimensionKey: string): { mindset: string; trait: string; pct: number }[] => {
  return traitMappings
    .filter((t) => (t as any)[dimensionKey] > 0)
    .map((t) => ({ mindset: t.mindset, trait: t.trait, pct: (t as any)[dimensionKey] }))
    .sort((a, b) => b.pct - a.pct);
};

// Grades offered at Orion with their routes
export interface GradeInfo {
  id: string;
  label: string;
  shortLabel: string;
  available: boolean;
  route: string;
}

export const grades: GradeInfo[] = [
  { id: "kg", label: "Kindergarten", shortLabel: "KG", available: true, route: "/grade/kg" },
  { id: "g1", label: "Grade 1", shortLabel: "G1", available: false, route: "/grade/g1" },
  { id: "g2", label: "Grade 2", shortLabel: "G2", available: false, route: "/grade/g2" },
  { id: "g3", label: "Grade 3", shortLabel: "G3", available: false, route: "/grade/g3" },
  { id: "g4", label: "Grade 4", shortLabel: "G4", available: false, route: "/grade/g4" },
  { id: "g5", label: "Grade 5", shortLabel: "G5", available: false, route: "/grade/g5" },
  { id: "g6", label: "Grade 6", shortLabel: "G6", available: false, route: "/grade/g6" },
  { id: "g7", label: "Grade 7", shortLabel: "G7", available: false, route: "/grade/g7" },
  { id: "g8", label: "Grade 8", shortLabel: "G8", available: false, route: "/grade/g8" },
  { id: "g9", label: "Grade 9", shortLabel: "G9", available: false, route: "/grade/g9" },
  { id: "g10", label: "Grade 10", shortLabel: "G10", available: false, route: "/grade/g10" },
  { id: "g11", label: "Grade 11", shortLabel: "G11", available: false, route: "/grade/g11" },
  { id: "g12", label: "Grade 12", shortLabel: "G12", available: false, route: "/grade/g12" },
];

// All courses offered at Orion (for the course web)
export interface OrionCourse {
  name: string;
  emoji: string;
  type: "core" | "dna";
  strand?: string;
  slug: string;
}

export const allCourses: OrionCourse[] = [
  // Core courses
  { name: "Science", emoji: "🔬", type: "core", slug: "science" },
  { name: "Mathematics", emoji: "📐", type: "core", slug: "mathematics" },
  { name: "ELA / Literacy", emoji: "📖", type: "core", slug: "ela-literacy" },
  { name: "Humanities", emoji: "🗺️", type: "core", slug: "humanities" },
  { name: "World Languages", emoji: "🌎", type: "core", slug: "world-languages" },
  { name: "Entrepreneurship", emoji: "💡", type: "core", slug: "entrepreneurship" },
  { name: "Path to Self-Efficacy", emoji: "🧠", type: "core", slug: "self-efficacy" },
  { name: "Music / Performing Arts", emoji: "🎵", type: "core", slug: "music-performing-arts" },
  { name: "Physical Education", emoji: "🏃", type: "core", slug: "physical-education" },
  // DNA Strands
  { name: "Communication", emoji: "🗣️", type: "dna", strand: "Human Skills", slug: "communication" },
  { name: "Storytelling", emoji: "📕", type: "dna", strand: "Human Skills", slug: "storytelling" },
  { name: "Leadership", emoji: "👑", type: "dna", strand: "Human Skills", slug: "leadership" },
  { name: "Impact", emoji: "🌟", type: "dna", strand: "Human Skills", slug: "impact" },
  { name: "Brain & Mind Science", emoji: "🧪", type: "dna", strand: "Human Science", slug: "brain-mind-science" },
  { name: "Health Science", emoji: "❤️‍🩹", type: "dna", strand: "Human Science", slug: "health-science" },
  { name: "Medical Science", emoji: "🏥", type: "dna", strand: "Human Science", slug: "medical-science" },
  { name: "Decision Science", emoji: "🎯", type: "dna", strand: "Human Science", slug: "decision-science" },
  { name: "Design & Making", emoji: "🎨", type: "dna", strand: "Design & Arts", slug: "design-making" },
  { name: "Visual Communication", emoji: "🖼️", type: "dna", strand: "Design & Arts", slug: "visual-communication" },
  { name: "Performance & Production", emoji: "🎭", type: "dna", strand: "Design & Arts", slug: "performance-production" },
  { name: "Makers Lab", emoji: "🔧", type: "dna", strand: "Design & Arts", slug: "makers-lab" },
  { name: "CS Thinking", emoji: "💻", type: "dna", strand: "CT & Engineering", slug: "cs-thinking" },
  { name: "Data Science", emoji: "📊", type: "dna", strand: "CT & Engineering", slug: "data-science" },
  { name: "AI Literacy", emoji: "🤖", type: "dna", strand: "CT & Engineering", slug: "ai-literacy" },
  { name: "Robotics", emoji: "⚙️", type: "dna", strand: "CT & Engineering", slug: "robotics" },
];

// Map PoL dimension title to key for lookup
const dimensionTitleToKey: Record<string, string> = {
  "Bold Visionary Leader": "boldVisionaryLeader",
  "Balanced Person": "balancedPerson",
  "Inspiring Communicator": "inspiringCommunicator",
  "Resilient Problem Solver": "resilientProblemSolver",
  "Respectful Relationship Builder": "respectfulRelationshipBuilder",
  "Caring Citizen": "caringCitizen",
};

// Get courses that contribute to a specific PoL dimension with their percentages
// Uses courseOverviews data imported dynamically to avoid circular deps
export const getCoursesForDimension = (dimensionKey: string): { name: string; emoji: string; slug: string; type: "core" | "dna"; pct: number }[] => {
  const dim = portraitDimensions.find(d => d.key === dimensionKey);
  if (!dim) return [];
  
  // We'll import this dynamically in the component instead
  return [];
};
