export interface Topic {
  slug: string;
  title: string;
  shortTitle: string;
  week: number;
  description: string;
}

export interface Unit {
  number: 1 | 2 | 3 | 4 | 5;
  slug: string;
  title: string;
  description: string;
  weeks: string;
  color: "unit-1" | "unit-2" | "unit-3" | "unit-4" | "unit-5";
  topics: Topic[];
}

export const curriculum: Unit[] = [
  {
    number: 1,
    slug: "unit-1-fractions",
    title: "Fractions",
    description: "Add, subtract, multiply, divide fractions and apply to quantities",
    weeks: "Weeks 1-3",
    color: "unit-1",
    topics: [
      {
        slug: "add-subtract",
        title: "Add and Subtract Fractions",
        shortTitle: "Add & Subtract",
        week: 1,
        description: "Common and uncommon denominators, Butterfly Method",
      },
      {
        slug: "multiply",
        title: "Multiply Fractions",
        shortTitle: "Multiply",
        week: 1,
        description: "Multiply numerators and denominators, simplify",
      },
      {
        slug: "divide",
        title: "Divide Fractions",
        shortTitle: "Divide",
        week: 1,
        description: "Invert and multiply (reciprocal method)",
      },
      {
        slug: "mixed-operations",
        title: "Mixed Operations (BODMAS)",
        shortTitle: "BODMAS",
        week: 2,
        description: "Order of operations with fractions",
      },
      {
        slug: "fraction-of-quantity",
        title: "Fraction of a Quantity",
        shortTitle: "Of a Quantity",
        week: 3,
        description: "Calculate a fraction of a given amount",
      },
      {
        slug: "whole-from-fractions",
        title: "Calculate the Whole from Fractions",
        shortTitle: "Find the Whole",
        week: 3,
        description: "Find the whole when given a part and its fraction",
      },
    ],
  },
  {
    number: 2,
    slug: "unit-2-decimals",
    title: "Decimals",
    description: "Compare, order, round decimals and express in standard form",
    weeks: "Weeks 4-5",
    color: "unit-2",
    topics: [
      {
        slug: "compare-order",
        title: "Compare and Order Decimals",
        shortTitle: "Compare & Order",
        week: 4,
        description: "Place value, ascending, descending, greater/less than",
      },
      {
        slug: "approximate",
        title: "Approximate Decimals",
        shortTitle: "Approximation",
        week: 4,
        description: "Round to whole numbers, decimal places, significant figures",
      },
      {
        slug: "standard-form",
        title: "Standard Form (Scientific Notation)",
        shortTitle: "Standard Form",
        week: 5,
        description: "Express numbers as a × 10^n",
      },
    ],
  },
  {
    number: 3,
    slug: "unit-3-decimal-operations",
    title: "Decimal Operations",
    description: "Convert, add, subtract, multiply and divide decimals",
    weeks: "Weeks 6-7",
    color: "unit-3",
    topics: [
      {
        slug: "convert",
        title: "Convert Decimals and Fractions",
        shortTitle: "Convert",
        week: 6,
        description: "Decimals to fractions and fractions to decimals",
      },
      {
        slug: "add-subtract",
        title: "Add and Subtract Decimals",
        shortTitle: "Add & Subtract",
        week: 6,
        description: "Align decimal points, insert zeros as placeholders",
      },
      {
        slug: "multiply-divide",
        title: "Multiply and Divide Decimals",
        shortTitle: "Multiply & Divide",
        week: 7,
        description: "By powers of 10, whole numbers, and decimals",
      },
    ],
  },
  {
    number: 4,
    slug: "unit-4-ratio-proportion",
    title: "Ratio & Proportion",
    description: "Define, simplify, and apply ratios to solve problems",
    weeks: "Weeks 8-9",
    color: "unit-4",
    topics: [
      {
        slug: "define-ratio",
        title: "Define a Ratio",
        shortTitle: "Define Ratio",
        week: 8,
        description: "Relationship between two or more quantities",
      },
      {
        slug: "fractions-and-ratios",
        title: "Fractions and Ratios",
        shortTitle: "Fractions & Ratios",
        week: 8,
        description: "Understand the relationship between fractions and ratios",
      },
      {
        slug: "simplify-ratios",
        title: "Simplify Ratios",
        shortTitle: "Simplify",
        week: 8,
        description: "Write ratios in their simplest form",
      },
      {
        slug: "divide-in-ratio",
        title: "Divide a Quantity in a Given Ratio",
        shortTitle: "Divide in Ratio",
        week: 9,
        description: "Share amounts using ratios",
      },
      {
        slug: "word-problems",
        title: "Proportional Parts Word Problems",
        shortTitle: "Word Problems",
        week: 9,
        description: "Solve real-world problems with ratios",
      },
    ],
  },
  {
    number: 5,
    slug: "unit-5-integers",
    title: "Integers",
    description: "Add, subtract, multiply, divide integers and apply to real-world problems",
    weeks: "Weeks 2-4",
    color: "unit-5",
    topics: [
      {
        slug: "add-subtract",
        title: "Add and Subtract Integers",
        shortTitle: "Add & Subtract",
        week: 2,
        description: "Use number lines and sign rules to add and subtract positive and negative numbers",
      },
      {
        slug: "multiply-divide",
        title: "Multiply and Divide Integers",
        shortTitle: "Multiply & Divide",
        week: 3,
        description: "Sign rules for multiplication and division with real-world thermometer problems",
      },
    ],
  },
];

export function getUnit(slug: string): Unit | undefined {
  return curriculum.find((u) => u.slug === slug);
}

export function getTopic(unitSlug: string, topicSlug: string): Topic | undefined {
  const unit = getUnit(unitSlug);
  return unit?.topics.find((t) => t.slug === topicSlug);
}

export function getUnitColor(unitNumber: 1 | 2 | 3 | 4 | 5): string {
  const colors = {
    1: "unit-1",
    2: "unit-2",
    3: "unit-3",
    4: "unit-4",
    5: "unit-5",
  };
  return colors[unitNumber];
}
