#!/usr/bin/env python3
"""Generate Teacher Guides for Weeks 2-4.

Run: python3 generate_teacher_guides.py
"""

import os, sys
sys.path.insert(0, os.path.dirname(__file__))
from teacher_guide import generate_teacher_guide

BASE = os.path.expanduser("~/Home_School/2nd_Grade/English_Language_Arts")

# =====================================================================
# Week 2 — Silent E Pattern
# =====================================================================
def generate_week2():
    WORDS = [
        ("police", "long i (silent e)", "people who keep us safe"),
        ("invite", "long i (silent e)", "to ask someone to come"),
        ("notice", "long i (silent e)", "to see or become aware"),
        ("polite", "long i (silent e)", "kind and respectful"),
        ("private", "long a (silent e)", "belonging only to you"),
        ("strange", "long a (silent e)", "weird or unusual"),
        ("create", "long a (silent e)", "to make something new"),
        ("delicate", "long a (silent e)", "very fine or easily broken"),
        ("separate", "long a (silent e)", "to divide into parts"),
        ("escape", "long a (silent e)", "to get away"),
        ("complete", "long e (silent e)", "finished or done"),
        ("frozen", "long o (silent e)", "very cold, turned to ice"),
    ]
    generate_teacher_guide(
        week_dir=os.path.join(BASE, "Week_02"), week_num=2,
        phonics_label="Silent_E_Pattern", words=WORDS,
        phonics_name="Silent E (Magic E)",

        monday_phonics_explanation=(
            "Silent E (Magic E) sits at the end of a word and makes the vowel say its name. "
            "The E itself is silent — it doesn't make a sound!"
        ),
        monday_grammar_focus="Sentences — Capital Letters & Punctuation",
        monday_grammar_explanation=(
            "A sentence is a group of words that makes a complete thought. "
            "It starts with a capital letter and ends with punctuation (.  ?  !)"
        ),
        monday_sort_labels=["Long A (a_e)", "Long E (e_e)", "Long I (i_e)", "Long O (o_e)"],
        monday_sort_answers=[
            ["strange", "create", "delicate", "separate", "escape"],
            ["complete"],
            ["police", "invite", "notice", "polite", "private"],
            ["frozen"],
        ],
        monday_fill_answers=["police", "invite", "notice", "polite"],
        monday_opposite_answers=[("polite", "rude, impolite"), ("private", "public, open")],
        monday_sentence_words=[w[0] for w in WORDS[:4]],

        tuesday_phonics_explanation=(
            "Today we practice Silent E patterns. Read each word slowly and listen for the long vowel sound the silent E creates."
        ),
        tuesday_scramble_answers=[],
        tuesday_comp_questions=[
            "What strange thing did they notice on their escape?",
            "What did they create during their trip?",
            "What became complete during their trip?",
        ],
        tuesday_comp_answers=[
            "They noticed a strange lighthouse on a cliff.",
            "They created a map of the island.",
            "Their island tour became complete.",
        ],
        tuesday_pattern_hunt_answers={"match": ["create", "polite", "private", "delicate", "separate", "escape", "complete", "frozen", "police", "invite", "notice", "strange"], "decoy": []},
        tuesday_swap_answers=[
            "notice / polite", "private / strange", "separate / frozen",
        ],
        tuesday_builder_prompts=[
            ("Write a sentence about an escape.", "escape"),
            ("Write a sentence about being polite.", "polite"),
            ("Write a sentence about creating something.", "create"),
        ],

        wednesday_phonics_explanation=(
            "Today we use Silent E words in reading, writing, and thinking. Each activity builds vocabulary in context."
        ),
        wednesday_vocab_q_question="In 'We were very polite about it,' what does polite mean?",
        wednesday_vocab_q_answer="B) Kind and respectful",
        wednesday_syn_ant_words=["polite", "strange", "create", "delicate", "escape", "private"],
        wednesday_word_web_center="create",
        wednesday_word_web_suggestions=["imagine", "build", "design", "invent", "make", "draw"],
        wednesday_sort_answers={"sentences": ["The police officer is very polite", "We invite our friends to create art"], "correct_order": ["The police officer is very polite.", "We invite our friends to create art."]},
        wednesday_correct_answers=[
            ("we invite you to our escape.", "We invite you to our escape."),
            ("the police notice everything.", "The police notice everything."),
            ("i create a delicate painting.", "I create a delicate painting."),
        ],
        wednesday_fill_answers=["complete", "private", "separate"],
        wednesday_context_clue_question="What does 'delicate' mean?",
        wednesday_context_clue_answer="B) Fragile and easily broken",
        wednesday_dictation_words=["polite", "strange", "create", "private", "frozen", "complete"],

        thursday_phonics_explanation=(
            "Today we use Silent E words in stories and writing. Use each word correctly in your sentences."
        ),
        thursday_comp_questions=[
            "Who was the strange guest?",
            "What did the police officer create?",
            "Where did she invite the class to go?",
        ],
        thursday_comp_answers=[
            "A police officer.",
            "A delicate display about staying safe.",
            "The police station.",
        ],
        thursday_detective_answers=[
            ("polise", "police"), ("invote", "invite"), ("notise", "notice"),
            ("polote", "polite"), ("prviate", "private"), ("strnage", "strange"),
            ("craete", "create"), ("delicat", "delicate"),
        ],
        thursday_swap_answers=["polite / private", "invite / frozen"],
        thursday_map_word="escape",
        thursday_map_suggestions=["Definition", "Sentence", "Synonym", "Antonym", "Drawing"],
        thursday_para_prompts=[
            "Write a paragraph about your dream escape.",
            "Write a paragraph about being polite to others.",
        ],

        friday_phonics_explanation=(
            "Today we review and assess everything we learned about Silent E this week."
        ),
        friday_test_answers=[w[0] for w in WORDS],
        friday_story_questions=[
            "What strange thing did they find at the beach?",
            "What did they create together?",
            "Why were the scientists happy?",
        ],
        friday_story_answers=[
            "A delicate shell frozen in ice.",
            "A private collection of shells.",
            "The students helped complete their project.",
        ],
        friday_opposite_answers=[("polite", "rude"), ("private", "public"), ("strange", "normal")],
        friday_builder_words=["escape", "create", "polite", "strange"],
        friday_journal_words=["notice", "delicate", "complete", "frozen"],
    )

# =====================================================================
# Week 3 — Vowel Teams: AI, AY, EE, EA
# =====================================================================
def generate_week3():
    WORDS = [
        ("railroad", "long a (ai)", "a road for trains"),
        ("rainbow", "long a (ai)", "a colorful arc in the sky"),
        ("rainfall", "long a (ai)", "the amount of rain that falls"),
        ("staircase", "long a (ai)", "a set of stairs"),
        ("mailbox", "long a (ai)", "a box for mail"),
        ("mainland", "long a (ai)", "the largest part of a country"),
        ("sweater", "long e (ee)", "a warm knitted top"),
        ("teacher", "long e (ee)", "someone who teaches"),
        ("street", "long e (ee)", "a road in a town"),
        ("cheese", "long e (ea)", "a food made from milk"),
        ("cheerful", "long e (ea)", "happy and in a good mood"),
        ("beefsteak", "long e (ea)", "a large piece of beef"),
    ]
    generate_teacher_guide(
        week_dir=os.path.join(BASE, "Week_03"), week_num=3,
        phonics_label="Vowel_Teams", words=WORDS,
        phonics_name="Vowel Teams: AI, AY, EE, EA",

        monday_phonics_explanation=(
            "Vowel TEAMS are two letters that work together to make ONE sound. "
            "AI and AY make long A (like rain), EE and EA make long E (like tree)."
        ),
        monday_grammar_focus="Verbs (Action Words)",
        monday_grammar_explanation=(
            "A verb is an action word — it tells what someone or something is doing. "
            "Examples: runs, eats, reads, jumps."
        ),
        monday_sort_labels=["Long A (ai)", "Long E (ee)", "Long E (ea)"],
        monday_sort_answers=[
            ["railroad", "rainbow", "rainfall", "staircase", "mailbox", "mainland"],
            ["sweater", "teacher", "street"],
            ["cheese", "cheerful", "beefsteak"],
        ],
        monday_fill_answers=["rainbow", "railroad", "teacher", "sweater"],
        monday_opposite_answers=[("cheerful", "sad, unhappy"), ("mainland", "island")],
        monday_sentence_words=[w[0] for w in WORDS[:4]],

        tuesday_phonics_explanation=(
            "Today we practice Vowel Team patterns. Read each word slowly and listen for the sound the team creates."
        ),
        tuesday_scramble_answers=[],
        tuesday_comp_questions=[
            "What appeared after the rainfall?",
            "What did they watch from the observation deck?",
            "What did they eat for dinner?",
        ],
        tuesday_comp_answers=[
            "A giant rainbow lit up the sky.",
            "The railroad cross the mainland bridge.",
            "Cheese and beefsteak by the campfire.",
        ],
        tuesday_pattern_hunt_answers={"match": ["railroad", "rainbow", "rainfall", "staircase", "mailbox", "mainland", "sweater", "teacher", "street", "cheese", "cheerful", "beefsteak"], "decoy": []},
        tuesday_swap_answers=["rainfall / staircase", "beefsteak / staircase", "cheese / rainfall"],
        tuesday_builder_prompts=[
            ("Write a sentence about a rainbow.", "rainbow"),
            ("Write a sentence about being cheerful.", "cheerful"),
            ("Write a sentence about the railroad.", "railroad"),
        ],

        wednesday_phonics_explanation=(
            "Today we use Vowel Team words in reading, writing, and thinking."
        ),
        wednesday_vocab_q_question="In 'Everyone was cheerful,' what does cheerful mean?",
        wednesday_vocab_q_answer="B) Happy and in a good mood",
        wednesday_syn_ant_words=["cheerful", "rainbow", "staircase", "teacher", "street", "railroad"],
        wednesday_word_web_center="teacher",
        wednesday_word_web_suggestions=["classroom", "student", "learn", "teach", "school", "lesson"],
        wednesday_sort_answers={"sentences": ["The teacher showed us the beautiful rainbow", "We rode the railroad across the mainland"], "correct_order": ["The teacher showed us the beautiful rainbow.", "We rode the railroad across the mainland."]},
        wednesday_correct_answers=[
            ("the teacher eats cheese on the street.", "The teacher eats cheese on the street."),
            ("we saw a rainbow after the rainfall.", "We saw a rainbow after the rainfall."),
            ("she climbs the tall staircase.", "She climbs the tall staircase."),
        ],
        wednesday_fill_answers=["teacher", "rainbow", "sweater"],
        wednesday_context_clue_question="What does 'rainfall' mean?",
        wednesday_context_clue_answer="B) Rain that falls from the sky",
        wednesday_dictation_words=["railroad", "rainbow", "staircase", "mailbox", "sweater", "cheese"],

        thursday_phonics_explanation=(
            "Today we use Vowel Team words in stories and writing."
        ),
        thursday_comp_questions=[
            "Where did the teacher take the class?",
            "What appeared after the rainfall?",
            "What did they eat for lunch?",
        ],
        thursday_comp_answers=[
            "The railroad station.",
            "A rainbow appeared.",
            "Cheese and beefsteak.",
        ],
        thursday_detective_answers=[
            ("rallroad", "railroad"), ("rainbou", "rainbow"), ("rainfll", "rainfall"),
            ("staircse", "staircase"), ("mialbox", "mailbox"), ("sweaer", "sweater"),
            ("techer", "teacher"), ("chease", "cheese"),
        ],
        thursday_swap_answers=["staircase / teacher", "rainfall / railroad"],
        thursday_map_word="rainbow",
        thursday_map_suggestions=["Definition", "Sentence", "Synonym", "Antonym", "Drawing"],
        thursday_para_prompts=[
            "Write a paragraph about your favorite trip.",
            "Write a paragraph about a cheerful day.",
        ],

        friday_phonics_explanation=(
            "Today we review and assess everything we learned about Vowel Teams this week."
        ),
        friday_test_answers=[w[0] for w in WORDS],
        friday_story_questions=[
            "Where did the teacher take the class?",
            "What did they see at the museum?",
            "What did they eat after the tour?",
        ],
        friday_story_answers=[
            "The railroad museum.",
            "A giant rainbow display.",
            "Cheese and beefsteak.",
        ],
        friday_opposite_answers=[("cheerful", "sad"), ("mainland", "island"), ("street", "alley")],
        friday_builder_words=["railroad", "rainbow", "teacher", "cheerful"],
        friday_journal_words=["staircase", "mailbox", "sweater", "cheese"],
    )

# =====================================================================
# Week 4 — Vowel Teams: OA, OW, OU, EW
# =====================================================================
def generate_week4():
    WORDS = [
        ("sailboat", "long o (oa)", "a boat moved by wind using sails"),
        ("toadstool", "long o (oa)", "a poisonous mushroom"),
        ("boatyard", "long o (oa)", "where boats are stored or built"),
        ("oatmeal", "long o (oa)", "a breakfast cereal from oats"),
        ("snowball", "oh sound (ow)", "a round ball of packed snow"),
        ("rainbow", "oh sound (ow)", "a colorful arc in the sky"),
        ("snowman", "oh sound (ow)", "a figure built from snow"),
        ("outdoor", "ou sound (ou)", "outside, in the open air"),
        ("trousers", "ou sound (ou)", "a garment covering the legs"),
        ("fountain", "ou sound (ou)", "a structure that shoots water"),
        ("mountain", "ou sound (ou)", "a very large natural hill"),
        ("newspaper", "ew sound (ew)", "a printed publication with news"),
    ]
    generate_teacher_guide(
        week_dir=os.path.join(BASE, "Week_04"), week_num=4,
        phonics_label="Vowel_Teams_OA_OW_OU_EW", words=WORDS,
        phonics_name="Vowel Teams: OA, OW, OU, EW",

        monday_phonics_explanation=(
            "Vowel TEAMS are two letters that work together to make ONE sound. "
            "OA makes long O (boat), OW makes long O (snow), OU makes ou (out), EW makes oo (new)."
        ),
        monday_grammar_focus="Verbs — Present vs. Past Tense (-ed)",
        monday_grammar_explanation=(
            "Adding -ed puts a verb in the past tense — the action is finished. "
            "Present: I run. Past: I ran. Regular verbs add -ed: walk → walked."
        ),
        monday_sort_labels=["Long O (oa)", "Long O (ow)", "Ou Sound (ou)", "Ew Sound (ew)"],
        monday_sort_answers=[
            ["sailboat", "toadstool", "boatyard", "oatmeal"],
            ["snowball", "rainbow", "snowman"],
            ["outdoor", "trousers", "fountain", "mountain"],
            ["newspaper"],
        ],
        monday_fill_answers=["rainbow", "snowman", "sailboat", "newspaper"],
        monday_opposite_answers=[("outdoor", "indoor"), ("mountain", "valley")],
        monday_sentence_words=[w[0] for w in WORDS[:4]],

        tuesday_phonics_explanation=(
            "Today we practice Vowel Team patterns. Read each word slowly and listen for the vowel team sound."
        ),
        tuesday_scramble_answers=[],
        tuesday_comp_questions=[
            "What did they build near the fountain?",
            "What appeared over the mountain after the storm?",
            "Where did they see a sailboat?",
        ],
        tuesday_comp_answers=[
            "A snowman stood tall near the fountain.",
            "A rainbow appeared over the mountain.",
            "A sailboat glided past at the boatyard.",
        ],
        tuesday_pattern_hunt_answers={"match": ["snowman", "fountain", "rainbow", "mountain", "snowball", "outdoor", "trousers", "boatyard", "sailboat", "oatmeal", "newspaper", "toadstool"], "decoy": []},
        tuesday_swap_answers=["snowman / rainbow", "boatyard / mountain", "oatmeal / outdoor"],
        tuesday_builder_prompts=[
            ("Write a sentence about a rainbow.", "rainbow"),
            ("Write a sentence about a snowball.", "snowball"),
            ("Write a sentence about a sailboat.", "sailboat"),
        ],

        wednesday_phonics_explanation=(
            "Today we use Vowel Team words in reading, writing, and thinking."
        ),
        wednesday_vocab_q_question="In 'We visited the boatyard,' what does boatyard mean?",
        wednesday_vocab_q_answer="B) A place where boats are stored or built",
        wednesday_syn_ant_words=["outdoor", "mountain", "rainbow", "sailboat", "snowman", "fountain"],
        wednesday_word_web_center="mountain",
        wednesday_word_web_suggestions=["hill", "peak", "climb", "rock", "snow", "trail"],
        wednesday_sort_answers={"sentences": ["The sailboat glided past the fountain", "A rainbow appeared over the mountain after the rain"], "correct_order": ["The sailboat glided past the fountain.", "A rainbow appeared over the mountain after the rain."]},
        wednesday_correct_answers=[
            ("the child throws a snowball outside.", "The child throws a snowball outside."),
            ("we saw a rainbow after the rain.", "We saw a rainbow after the rain."),
            ("she reads the newspaper every morning.", "She reads the newspaper every morning."),
        ],
        wednesday_fill_answers=["rainbow", "snowman", "sailboat"],
        wednesday_context_clue_question="What does 'rainbow' mean?",
        wednesday_context_clue_answer="B) A colorful arc of light after rain",
        wednesday_dictation_words=["sailboat", "snowball", "rainbow", "outdoor", "trousers", "mountain"],

        thursday_phonics_explanation=(
            "Today we use Vowel Team words in stories and writing."
        ),
        thursday_comp_questions=[
            "Where did the child take the sailboat?",
            "What appeared over the mountain after the rain?",
            "What did the friend read under the tree?",
        ],
        thursday_comp_answers=[
            "The outdoor pond.",
            "A rainbow appeared.",
            "The newspaper.",
        ],
        thursday_detective_answers=[
            ("sailbaot", "sailboat"), ("toadsol", "toadstool"), ("boatyrd", "boatyard"),
            ("oatmel", "oatmeal"), ("snowbal", "snowball"), ("rainbw", "rainbow"),
            ("snowmn", "snowman"), ("outdor", "outdoor"),
        ],
        thursday_swap_answers=["snowman / rainbow", "boatyard / mountain"],
        thursday_map_word="sailboat",
        thursday_map_suggestions=["Definition", "Sentence", "Synonym", "Antonym", "Drawing"],
        thursday_para_prompts=[
            "Write a paragraph about a snowy day.",
            "Write a paragraph about a day at the boatyard.",
        ],

        friday_phonics_explanation=(
            "Today we review and assess everything we learned about Vowel Teams this week."
        ),
        friday_test_answers=[w[0] for w in WORDS],
        friday_story_questions=[
            "What glided past the fountain?",
            "What appeared over the mountain?",
            "Where did Dad read the newspaper?",
        ],
        friday_story_answers=[
            "The sailboat glided past.",
            "A rainbow appeared.",
            "At the boatyard.",
        ],
        friday_opposite_answers=[("outdoor", "indoor"), ("mountain", "valley"), ("snowball", "warm ball")],
        friday_builder_words=["sailboat", "rainbow", "snowman", "fountain"],
        friday_journal_words=["trousers", "boatyard", "newspaper", "toadstool"],
    )


def main():
    for week_fn in [generate_week2, generate_week3, generate_week4]:
        wn = week_fn.__name__.replace("generate_week", "")
        print(f"\nGenerating Teacher Guide for Week {wn}...")
        week_fn()
        print(f"  ✓ Week {wn} Teacher Guide generated!")
    print("\nAll teacher guides generated!")


if __name__ == "__main__":
    main()