#!/usr/bin/env python3
"""
Week 18 Generator - Context Clues & Paragraph Structure

Uses the shared module system (monday.py, tuesday.py, wednesday.py, thursday.py, friday.py, teacher_guide.py).

Topic: Context Clues (Definition, Example, Contrast, Description) + Paragraph Structure (Topic/Detail/Conclusion)
Words: mysterious, tiny, fragile, furious, nervous, peaceful, terrible, enormous, ancient, abundant, cautious, reluctant
Pattern: Common suffixes (-ious, -ous, -ful, -ible, -ile, irregular, short_u)
"""
import os
import sys

# Add course root to path so we can import shared modules
COURSE_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, COURSE_ROOT)

from monday import generate_monday
from tuesday import generate_tuesday
from wednesday import generate_wednesday
from thursday import generate_thursday
from friday import generate_friday
from teacher_guide import generate_teacher_guide

# =====================================================================
# WEEK 18 DATA
# =====================================================================

WEEK = os.path.join(COURSE_ROOT, "Week_18")
PHONICS_LABEL = "Context Clues"

# 4-tuple: (word, pattern_code, phonics_note, context_definition)
WORDS = [
    ("mysterious", "suffix_ious", "ends with -ious, sounds like ee-uhs", "strange and difficult to understand"),
    ("tiny", "suffix_y", "y makes short i sound at the end", "very, very small"),
    ("fragile", "suffix_ile", "ends with -ile, sounds like ih-ul", "easily broken or damaged"),
    ("furious", "suffix_ious", "ends with -ious, sounds like ee-uhs", "extremely angry"),
    ("nervous", "suffix_ous", "ends with -ous, sounds like uhs", "worried or anxious about something"),
    ("peaceful", "suffix_ful", "ends with -ful, means full of", "calm and quiet, without trouble"),
    ("terrible", "suffix_ible", "ends with -ible, means able to be", "very bad or unpleasant"),
    ("enormous", "suffix_ous", "ends with -ous, sounds like uhs", "very, very big"),
    ("ancient", "irregular", "ends with -ent, means very old", "from a very long time ago"),
    ("abundant", "short_u", "u makes short uh sound in middle", "having a lot of something"),
    ("cautious", "suffix_ious", "ends with -ious, sounds like ee-uhs", "careful to avoid danger or mistakes"),
    ("reluctant", "short_u", "u makes short uh sound in middle", "not wanting to do something"),
]

LEARNING_SKILLS_MON = [
    "Recognize common suffix patterns (-ious, -ous, -ful, -ible, -ile)",
    "Use context clues to figure out unfamiliar word meanings",
    "Identify definition clues in surrounding text",
]

LEARNING_SKILLS_TUE = [
    "Identify paragraph parts: topic sentence, details, conclusion",
    "Read for context and meaning",
    "Practice spelling with suffix words",
]

LEARNING_SKILLS_WED = [
    "Classify context clue types: Definition, Example, Contrast, Description",
    "Label paragraph sentences as Topic (T), Detail (D), or Conclusion (C)",
    "Expand vocabulary through synonyms and antonyms",
]

LEARNING_SKILLS_THU = [
    "Write sentences that provide context clues for others",
    "Build complete paragraphs with topic, details, and conclusion",
    "Apply paragraph structure in creative writing",
]

LEARNING_SKILLS_FRI = [
    "Demonstrate knowledge of all 12 spelling words",
    "Use context clues independently to determine word meanings",
    "Identify paragraph structure in reading",
]

# =====================================================================
# MONDAY DATA
# =====================================================================

LEARNING_TEXT_MON = (
    "Many English words end with special patterns called suffixes. "
    "Today we'll learn about -ious, -ous, -ful, -ible, and -ile. "
    "When you see an unfamiliar word, look at the words around it for clues about the meaning!"
)

VOWEL_EXAMPLES = [
    "mysterious &mdash; <em>-ious</em> suffix (ee-uhs)",
    "nervous &mdash; <em>-ous</em> suffix (uhs)",
    "peaceful &mdash; <em>-ful</em> suffix (full of)",
    "fragile &mdash; <em>-ile</em> suffix (ih-ul)",
    "terrible &mdash; <em>-ible</em> suffix (able to be)",
]

GRAMMAR_NOTE = "Context clues help readers figure out word meanings from surrounding text."

GRAMMAR_DEEP = (
    "Four types of context clues:\n"
    "1. Definition - the meaning is stated right there\n"
    "2. Example - examples help you picture the word\n"
    "3. Contrast - opposite words show what it isn't\n"
    "4. Description - details paint a picture of the meaning"
)

# Context clue sentences for Monday introduction (sentence, target_word)
MONDAY_CONTEXT_CLUE_SENTENCES = [
    ("The mysterious box had no label or note attached to it.", "mysterious"),
    ("The tiny seed was smaller than a grain of rice.", "tiny"),
    ("Handle the fragile vase carefully so it does not break.", "fragile"),
    ("The furious dog growled and barked at the mail carrier.", "furious"),
]

# Context clue sort: {clue_type: [words]}
MONDAY_CONTEXT_CLUE_SORT = {
    "Definition": ["mysterious", "tiny", "fragile", "ancient"],
    "Example": ["furious", "nervous", "peaceful"],
    "Contrast": ["terrible", "enormous", "abundant"],
    "Description": ["cautious", "reluctant"],
}

MONDAY_GRAMMAR_PRACTICE = [
    ("The __________ cave had strange markings on the walls.", "mysterious"),
    ("She found a __________ insect on the leaf.", "tiny"),
]

MONDAY_STORY = (
    "Lily found a mysterious old map in her grandmother's attic. "
    "It was fragile and yellow with age. The map showed a tiny island "
    "in an enormous lake. Lily felt nervous about telling anyone - "
    "what if someone thought she was making it up? But the ancient map "
    "was too interesting to keep secret. She showed her cautious father, "
    "who was reluctant at first but eventually agreed to help her search. "
    "The peaceful morning turned into a furious adventure as they raced "
    "to find the island. To their surprise, shells and treasures were "
    "abundant there. It was not a terrible dream - it was the best day ever!"
)

MONDAY_SORT_LABELS = ["-ious", "-ous", "-ful", "-ible", "-ile", "Other"]
TEACHER_MONDAY_SORT_ANSWERS = {
    "-ious": ["mysterious", "furious", "cautious"],
    "-ous": ["nervous", "enormous"],
    "-ful": ["peaceful"],
    "-ible": ["terrible"],
    "-ile": ["fragile"],
    "Other": ["tiny", "ancient", "abundant", "reluctant"],
}

MONDAY_FILL_DATA = [
    ("The detective tried to solve the __________ disappearance.", "mysterious"),
    ("A __________ star could be seen twinkling in the night sky.", "tiny"),
    ("The __________ glass shattered when it fell on the floor.", "fragile"),
]

MONDAY_OPPOSITE_WORDS = ["tiny", "peaceful", "enormous", "abundant"]
TEACHER_MONDAY_OPPOSITE_ANSWERS = [
    ("tiny", "huge"),
    ("peaceful", "chaotic"),
    ("enormous", "tiny"),
    ("abundant", "scarce"),
]

MONDAY_SENTENCE_WORDS = ["mysterious", "fragile", "furious", "peaceful", "enormous", "cautious"]

# =====================================================================
# TUESDAY DATA
# =====================================================================

TUESDAY_LEARNING = (
    "Good paragraphs have three parts: a topic sentence that tells the main idea, "
    "detail sentences that give information and examples, and a conclusion that wraps things up. "
    "Today we'll practice identifying and building these parts."
)

TUESDAY_READING = (
    "Word patterns are like secret codes in English. When you learn to recognize them, "
    "reading becomes easier. For example, words ending in -ous often mean 'full of something.' "
    "Mysterious means full of mystery. Furious means full of fury or anger. Nervous means full of nerves. "
    "Words ending in -ful also mean 'full of.' Peaceful means full of peace. "
    "Words ending in -ible mean 'able to be.' Fragile means able to be broken. "
    "Terrible means able to be feared. When you see these patterns, you can often guess "
    "the meaning even if you have never seen the word before!"
)

TUESDAY_COMP_QUESTIONS = [
    "What does -ous usually mean?",
    "Name two words from the passage that end in -ful.",
    "What does -ible mean?",
    "Why are word patterns helpful for reading?",
]

TEACHER_TUESDAY_COMP_ANSWERS = [
    "-ous usually means 'full of something.'",
    "peaceful (only one -ful word appears in the passage)",
    "-ible means 'able to be.'",
    "Word patterns help you guess the meaning of unfamiliar words.",
]

TUESDAY_SCRAMBLE_WORDS = ["enormous", "ancient", "fragile", "mysterious"]
TEACHER_TUESDAY_SCRAMBLE_ANSWERS = [
    ("ermnorosu", "enormous"),
    ("naceatni", "ancient"),
    ("gaeliraf", "fragile"),
    ("rousmeterys", "mysterious"),
]

# Paragraph example for Tuesday (topic_sentence, [details], [conclusion])
TUESDAY_REMEMBER_BOXES = [
    ("Paragraph Parts",
     "A good paragraph has three parts: a topic sentence (tells the main idea), "
     "detail sentences (give information and examples), and a conclusion sentence (wraps things up)."),
]

TUESDAY_PARAGRAPH_EXAMPLE = (
    "Suffixes are special word patterns that help us understand meaning.",
    "Words like mysterious and furious end with -ious. Words like nervous and enormous end with -ous. The suffix -ful means full of, like in peaceful.",
    "Learning these patterns makes reading and spelling much easier!",
)

TUESDAY_PATTERN_HUNT_WORDS = [
    "mysterious", "nervous", "peaceful", "terrible", "fragile",
    "happy", "quick", "green", "fast", "tall",
]

TEACHER_TUESDAY_PATTERN_HUNT = {
    "match": ["mysterious", "nervous", "peaceful", "terrible", "fragile"],
    "decoy": ["happy", "quick", "green", "fast", "tall"],
}

TUESDAY_SWAP_DATA = [
    (
        "The enormous dinosaur walked across the field.",
        ("enormous", "tiny"),
    ),
    (
        "The peaceful lake reflected the stars.",
        ("peaceful", "furious"),
    ),
]

TUESDAY_BUILDER_PROMPTS = [
    ("Write about something mysterious", "mysterious"),
    ("Write about a tiny creature", "tiny"),
]

# =====================================================================
# WEDNESDAY DATA
# =====================================================================

WEDNESDAY_LEARNING = (
    "Context clues come in different types. Today you will learn to identify "
    "Definition clues (the meaning is stated), Example clues (examples help you picture it), "
    "Contrast clues (opposite words show what it isn't), and Description clues "
    "(details paint a picture of the meaning)."
)

WEDNESDAY_READING = (
    "Scientists study ancient fossils to learn about the past. "
    "Dinosaur bones are often fragile and must be handled with extreme care. "
    "Some discoveries are mysterious because the bones do not match any known species. "
    "The enormous skeleton of a T-Rex takes up an entire museum room. "
    "Fossil findings are abundant in certain regions like Montana and Utah. "
    "Cautious researchers spend years studying each find before drawing conclusions. "
    "Some scientists are reluctant to announce new species until they are absolutely certain."
)

WEDNESDAY_VOCAB_Q = (
    "In the passage, what does &ldquo;abundant&rdquo; mean? "
    "Point to the clue that helped you figure it out."
)

TEACHER_WEDNESDAY_VOCAB_Q_QUESTION = WEDNESDAY_VOCAB_Q
TEACHER_WEDNESDAY_VOCAB_Q_ANSWER = (
    "Abundant = having a lot of / plentiful. "
    "Clue: 'Fossil findings are abundant in certain regions like Montana and Utah' "
    "suggests there are many fossils in those places."
)

WEDNESDAY_SYN_ANT = ["mysterious", "enormous", "peaceful", "terrible", "ancient", "cautious"]

WEDNESDAY_WORD_WEB_CENTER = "Context Clues"
WEDNESDAY_WORD_WEB_INSTRUCTION = (
    "Write 4 words or phrases connected to 'Context Clues.' "
    "Examples: Definition, Example, Contrast, Description."
)

LEARNING_SKILLS_WED = LEARNING_SKILLS_WED

WEDNESDAY_SORT_DATA = [
    "The cautious hiker checked the weather before climbing",
    "Abundant wildflowers covered the peaceful meadow",
]

TEACHER_WEDNESDAY_SORT_ANSWERS = {
    "sentences": [
        "hiker weather The before climbing checked cautious the",
        "wildflowers peaceful Abundant meadow covered the the",
    ],
    "correct_order": [
        "The cautious hiker checked the weather before climbing.",
        "Abundant wildflowers covered the peaceful meadow.",
    ],
}

WEDNESDAY_CORRECT = [
    "the mysterious box was ancient",
    "fragile glass can break easily",
    "the enormous wave crashed",
]

TEACHER_WEDNESDAY_CORRECT_ANSWERS = [
    ("the mysterious box was ancient", "The mysterious box was ancient."),
    ("fragile glass can break easily", "Fragile glass can break easily."),
    ("the enormous wave crashed", "The enormous wave crashed."),
]

WEDNESDAY_FILL = [
    ("The __________ ruins were discovered in the desert.", "ancient"),
    ("She gave a __________ look before stepping onto the stage.", "nervous"),
    ("The __________ storm destroyed the old barn.", "terrible"),
]

TEACHER_WEDNESDAY_FILL_ANSWERS = ["ancient", "nervous", "terrible"]

# Context clue detective: sentences where student identifies clue type
WEDNESDAY_CONTEXT_CLUE_DETECTIVE = [
    "The mysterious creature, which means strange and puzzling, appeared at midnight.",
    "She was not calm or relaxed; she was furious.",
    "Such as a sparrow or a finch, the tiny bird was barely visible.",
    "The enormous elephant, huge and towering, filled the entire enclosure.",
    "The ancient castle, built many centuries ago, still stood tall.",
    "Unlike the peaceful lake, the furious river raged through the valley.",
    "The fragile butterfly, which can be easily damaged, landed on her finger.",
    "Examples of abundant food include fruits, vegetables, and grains.",
    "The nervous child, shaking and anxious, hid behind his mother.",
    "The reluctant student, who did not want to participate, finally raised his hand.",
    "The terrible weather, awful and unpleasant, kept everyone indoors.",
    "The cautious explorer, careful and watchful, checked every path.",
]

TEACHER_WEDNESDAY_DETECTIVE_ANSWERS = [
    ("The mysterious creature, which means strange and puzzling, appeared at midnight.", "Definition"),
    ("She was not calm or relaxed; she was furious.", "Contrast"),
    ("Such as a sparrow or a finch, the tiny bird was barely visible.", "Example"),
    ("The enormous elephant, huge and towering, filled the entire enclosure.", "Description"),
    ("The ancient castle, built many centuries ago, still stood tall.", "Definition"),
    ("Unlike the peaceful lake, the furious river raged through the valley.", "Contrast"),
    ("The fragile butterfly, which can be easily damaged, landed on her finger.", "Definition"),
    ("Examples of abundant food include fruits, vegetables, and grains.", "Example"),
    ("The nervous child, shaking and anxious, hid behind his mother.", "Description"),
    ("The reluctant student, who did not want to participate, finally raised his hand.", "Definition"),
    ("The terrible weather, awful and unpleasant, kept everyone indoors.", "Description"),
    ("The cautious explorer, careful and watchful, checked every path.", "Description"),
]

# Paragraph label: sentences for student to label T, D, or C
WEDNESDAY_PARAGRAPH_LABEL_DATA = [
    "Suffixes are important word patterns in English.",
    "Words like mysterious, furious, and cautious end with -ious.",
    "Words like nervous and enormous end with -ous.",
    "The suffix -ful means full of, as in peaceful.",
    "Words ending in -ible mean able to be, like fragile and terrible.",
    "Understanding these patterns helps you learn new vocabulary.",
]

TEACHER_WEDNESDAY_PARAGRAPH_LABEL_ANSWERS = [
    ("Suffixes are important word patterns in English.", "T"),
    ("Words like mysterious, furious, and cautious end with -ious.", "D"),
    ("Words like nervous and enormous end with -ous.", "D"),
    ("The suffix -ful means full of, as in peaceful.", "D"),
    ("Words ending in -ible mean able to be, like fragile and terrible.", "D"),
    ("Understanding these patterns helps you learn new vocabulary.", "C"),
]

# =====================================================================
# THURSDAY DATA
# =====================================================================

THURSDAY_LEARNING = (
    "Today you will write your own context clue sentences and build complete paragraphs. "
    "A good paragraph has a topic sentence, supporting details, and a conclusion. "
    "When you write context clues for others, you become a better reader too!"
)

REMINDER_TEXT = (
    "Context Clue Types: Definition (states the meaning), Example (gives examples), "
    "Contrast (shows the opposite), Description (paints a picture). "
    "Paragraph Parts: Topic sentence (main idea) &rarr; Details (support) &rarr; Conclusion (wrap up)."
)

THURSDAY_STORY = (
    "At the museum, Maya saw a mysterious fossil that looked like nothing she had ever seen. "
    "The tiny bones were no bigger than her fingernail. The curator explained that fragile "
    "fossils like this must be preserved with extreme care. Maya was furious when a tourist "
    "got too close to the display. She felt nervous that the fossil might break. "
    "Eventually, a peaceful explanation from the curator calmed everyone down. "
    "It would have been terrible if anything happened to the ancient specimen. "
    "The enormous exhibit hall was filled with abundant dinosaur fossils. "
    "Maya was cautious around every display and reluctant to leave such an amazing place."
)

THURSDAY_COMP_QUESTIONS = [
    "Why was Maya furious at the tourist?",
    "What made the fossil special?",
    "Name three suffix words from the story.",
    "What type of context clue helps you understand 'fragile' in the story?",
]

TEACHER_THURSDAY_COMP_ANSWERS = [
    "Maya was furious because a tourist got too close to the fragile fossil display.",
    "The fossil was tiny - no bigger than her fingernail - and looked like nothing she had seen before.",
    "Any three of: mysterious, tiny, fragile, furious, nervous, peaceful, terrible, enormous, ancient, abundant, cautious, reluctant",
    "Definition clue - 'fragile fossils like this must be preserved with extreme care' suggests it breaks easily.",
]

THURSDAY_SORT_DATA = [
    "Context clues help readers figure out word meanings",
    "Good paragraphs have a topic sentence details and conclusion",
]

TEACHER_THURSDAY_SORT_ANSWERS = {
    "sentences": [
        "clues Context readers meanings help figure word out",
        "Good paragraphs have a topic sentence details and conclusion",
    ],
    "correct_order": [
        "Context clues help readers figure out word meanings.",
        "Good paragraphs have a topic sentence, details, and conclusion.",
    ],
}

THURSDAY_DETECTIVE = ["myssterious", "tinny", "fragil", "furius", "nerves", "peacful",
                       "terribl", "enormus", "anciant", "abundan", "cautios", "reluctnt"]

TEACHER_THURSDAY_DETECTIVE_ANSWERS = [
    ("myssterious", "mysterious"), ("tinny", "tiny"), ("fragil", "fragile"),
    ("furius", "furious"), ("nerves", "nervous"), ("peacful", "peaceful"),
    ("terribl", "terrible"), ("enormus", "enormous"), ("anciant", "ancient"),
    ("abundan", "abundant"), ("cautios", "cautious"), ("reluctnt", "reluctant"),
]

TUESDAY_SWAP_DATA = [
    (
        "The enormous whale swam through the tiny harbor.",
        ("enormous", "tiny"),
        ("tiny", "enormous"),
    ),
    (
        "The peaceful garden was beside the furious river.",
        ("peaceful", "furious"),
        ("furious", "peaceful"),
    ),
]

THURSDAY_SWAP_DATA = [
    (
        "The enormous dinosaur walked across the tiny field.",
        ("enormous", "tiny"),
        ("tiny", "enormous"),
    ),
    (
        "The peaceful lake reflected the furious storm clouds.",
        ("peaceful", "furious"),
        ("furious", "peaceful"),
    ),
]

TEACHER_THURSDAY_SWAP_ANSWERS = [
    "tiny, enormous",
    "furious, peaceful",
]

THURSDAY_MAP_WORD = "reluctant"

TEACHER_THURSDAY_MAP_SUGGESTIONS = [
    "Meaning: not wanting to do something / unwilling",
    "Pattern: ends with -ant (irregular)",
    "Example: She was reluctant to try the spicy food.",
]

# Context clue writing words
THURSDAY_CONTEXT_CLUE_WRITING = ["mysterious", "fragile", "enormous"]

# Fix paragraph - body text (missing topic and conclusion)
THURSDAY_FIX_PARAGRAPH = (
    "Words like mysterious and furious end with -ious. "
    "Words like nervous and enormous end with -ous. "
    "The suffix -ful means full of, as in peaceful. "
    "Words ending in -ible mean able to be, like fragile and terrible."
)

TEACHER_THURSDAY_FIX_TOPIC = "Many English words share common suffix patterns that tell us about their meaning."
TEACHER_THURSDAY_FIX_CONCLUSION = "When you recognize these patterns, you can guess the meaning of new words."

THURSDAY_PARA_PROMPTS = [
    "Write a paragraph about a mysterious discovery. Use at least 3 spelling words.",
    "Write a paragraph about an ancient place you would like to visit. Use at least 3 spelling words.",
]

THURSDAY_STORY_PROMPT = "Write a story using at least 5 of your spelling words. Include context clues so your reader can figure out the meanings."

# =====================================================================
# FRIDAY DATA
# =====================================================================

FRIDAY_REVIEW_STORY = (
    "The <strong>mysterious</strong> old letter was <strong>tiny</strong> and <strong>fragile</strong>. When Emma opened it, "
    "she was <strong>furious</strong> at first - it seemed to be a <strong>terrible</strong> prank. But as she "
    "read on, she became <strong>peaceful</strong> with excitement. The <strong>enormous</strong> treasure map "
    "was hidden inside the <strong>ancient</strong> envelope. Gold coins were <strong>abundant</strong> on the "
    "island it described. Emma felt <strong>nervous</strong> but was <strong>cautious</strong> about telling her <strong>reluctant</strong> brother, "
    "but they went on the adventure together anyway."
)

FRIDAY_STORY_QUESTIONS = [
    "Why was Emma furious at first?",
    "What was hidden in the ancient envelope?",
    "Name two words from the story that describe how Emma felt.",
]

TEACHER_FRIDAY_STORY_ANSWERS = [
    "Emma was furious because she thought the letter was a terrible prank.",
    "An enormous treasure map was hidden inside.",
    "Any two of: furious, peaceful, cautious, reluctant, nervous",
]

FRIDAY_OPPOSITE_WORDS = ["tiny", "peaceful", "abundant", "cautious"]

TEACHER_FRIDAY_OPPOSITE_ANSWERS = [
    ("tiny", "enormous"),
    ("peaceful", "furious"),
    ("abundant", "scarce"),
    ("cautious", "careless"),
]

FRIDAY_BUILDER_WORDS = ["mysterious", "enormous", "ancient", "reluctant"]
FRIDAY_JOURNAL_WORDS = ["tiny", "fragile", "furious", "nervous"]

# Guess the meaning: (sentence_with_blank, word)
FRIDAY_GUESS_MEANING = [
    ("Something that is ______ is strange and hard to understand.", "mysterious"),
    ("Something that is ______ is very, very small.", "tiny"),
    ("Something that is ______ can be broken easily.", "fragile"),
    ("Someone who is ______ is extremely angry.", "furious"),
    ("A place that is ______ is calm and quiet.", "peaceful"),
    ("Something that is ______ is from a very long time ago.", "ancient"),
]

TEACHER_FRIDAY_GUESS_ANSWERS = [
    ("mysterious", "strange and hard to understand"),
    ("tiny", "very, very small"),
    ("fragile", "can be broken easily"),
    ("furious", "extremely angry"),
    ("peaceful", "calm and quiet"),
    ("ancient", "from a very long time ago"),
]

# Paragraph parts review text
FRIDAY_PARAGRAPH_PARTS_REVIEW = (
    "Recognizing word patterns makes learning new words much easier. "
    "When you see -ous at the end of a word, it often means full of something. "
    "The suffix -ful also means full of, like in peaceful meaning full of peace. "
    "Words ending in -ible mean able to be, such as fragile meaning able to be broken. "
    "Once you know these patterns, reading unfamiliar words becomes a fun puzzle."
)

TEACHER_FRIDAY_PARAGRAPH_ANSWERS = {
    "topic": "Recognizing word patterns makes learning new words much easier.",
    "details": [
        "When you see -ous at the end of a word, it often means full of something.",
        "The suffix -ful also means full of, like in peaceful meaning full of peace.",
        "Words ending in -ible mean able to be, such as fragile meaning able to be broken.",
    ],
    "conclusion": "Once you know these patterns, reading unfamiliar words becomes a fun puzzle.",
}

# =====================================================================
# TEACHER GUIDE DATA
# =====================================================================

TEACHER_MONDAY_PHONICS_EXPLANATION = (
    "Students learn 12 vocabulary words with common suffix patterns "
    "(-ious, -ous, -ful, -ible, -ile) and are introduced to context clues. "
    "Context clues are hints in surrounding text that help readers figure out unfamiliar words."
)

TEACHER_MONDAY_GRAMMAR_FOCUS = "Context Clues - Definition"

TEACHER_MONDAY_GRAMMAR_EXPLANATION = (
    "Definition context clues state the meaning directly in the sentence. "
    "Example: 'The mysterious, or strange and puzzling, box caught her attention.' "
    "Watch for signal phrases like 'which means,' 'or,' 'that is,' and commas setting off definitions."
)

TEACHER_MONDAY_SENTENCE_WORDS = MONDAY_SENTENCE_WORDS

TEACHER_TUESDAY_PHONICS_EXPLANATION = (
    "Students read about suffix patterns and practice identifying paragraph structure. "
    "They learn that good paragraphs have three parts: topic sentence, detail sentences, "
    "and a conclusion sentence."
)

TEACHER_WEDNESDAY_PHONICS_EXPLANATION = (
    "Students classify context clues into four types: Definition, Example, Contrast, "
    "and Description. They practice labeling paragraph parts as Topic (T), Detail (D), "
    "or Conclusion (C)."
)

TEACHER_WEDNESDAY_DICTATION_WORDS = ["mysterious", "fragile", "furious", "enormous", "ancient", "cautious"]

TEACHER_THURSDAY_PHONICS_EXPLANATION = (
    "Students write their own context clue sentences and build paragraphs with proper structure. "
    "They practice adding topic sentences and conclusions to incomplete paragraphs."
)

TEACHER_FRIDAY_PHONICS_EXPLANATION = (
    "Assessment day. Students demonstrate understanding of suffix patterns, context clue types, "
    "and paragraph structure through spelling tests, reading comprehension, and writing."
)

# =====================================================================
# GENERATION
# =====================================================================

def generate(week_dir=None, week_num=18):
    if week_dir is None:
        week_dir = WEEK

    # Modules expect 3-tuples; our data has 4. Strip the 4th element.
    W3 = [(w, p, n) for w, p, n, _ in WORDS]

    # Monday
    generate_monday(
        week_dir=week_dir,
        week_num=week_num,
        phonics_label=PHONICS_LABEL,
        words=W3,
        learning_text=LEARNING_TEXT_MON,
        vowel_examples=VOWEL_EXAMPLES,
        grammar_note=GRAMMAR_NOTE,
        grammar_deep=GRAMMAR_DEEP,
        grammar_practice=MONDAY_GRAMMAR_PRACTICE,
        story_text=MONDAY_STORY,
        sort_labels=MONDAY_SORT_LABELS,
        sort_title="Suffix Sort",
        fill_data=MONDAY_FILL_DATA,
        opposite_words=MONDAY_OPPOSITE_WORDS,
        sentence_words=MONDAY_SENTENCE_WORDS,
        learning_skills=LEARNING_SKILLS_MON,
        context_clue_sentences=MONDAY_CONTEXT_CLUE_SENTENCES,
        context_clue_sort=MONDAY_CONTEXT_CLUE_SORT,
    )

    # Tuesday
    generate_tuesday(
        week_dir=week_dir,
        week_num=week_num,
        phonics_label=PHONICS_LABEL,
        words=W3,
        learning_text=TUESDAY_LEARNING,
        vowel_examples=VOWEL_EXAMPLES,
        reading_text=TUESDAY_READING,
        comp_questions=TUESDAY_COMP_QUESTIONS,
        remember_boxes=TUESDAY_REMEMBER_BOXES,
        scramble_words=TUESDAY_SCRAMBLE_WORDS,
        pattern_hunt_words=TUESDAY_PATTERN_HUNT_WORDS,
        swap_data=TUESDAY_SWAP_DATA,
        builder_prompts=TUESDAY_BUILDER_PROMPTS,
        learning_skills=LEARNING_SKILLS_TUE,
        paragraph_example=TUESDAY_PARAGRAPH_EXAMPLE,
    )

    # Wednesday
    generate_wednesday(
        week_dir=week_dir,
        week_num=week_num,
        phonics_label=PHONICS_LABEL,
        words=W3,
        learning_text=WEDNESDAY_LEARNING,
        learning_skills=LEARNING_SKILLS_WED,
        reading_passage=WEDNESDAY_READING,
        vocab_question=WEDNESDAY_VOCAB_Q,
        syn_ant_words=WEDNESDAY_SYN_ANT,
        word_web_center=WEDNESDAY_WORD_WEB_CENTER,
        word_web_instruction=WEDNESDAY_WORD_WEB_INSTRUCTION,
        sentence_sort_data=WEDNESDAY_SORT_DATA,
        correct_sentences=WEDNESDAY_CORRECT,
        fill_data=WEDNESDAY_FILL,
        context_clue_detective=WEDNESDAY_CONTEXT_CLUE_DETECTIVE,
        paragraph_label_data=WEDNESDAY_PARAGRAPH_LABEL_DATA,
    )

    # Thursday
    generate_thursday(
        week_dir=week_dir,
        week_num=week_num,
        phonics_label=PHONICS_LABEL,
        words=W3,
        learning_text=THURSDAY_LEARNING,
        remember_text=REMINDER_TEXT,
        story_text=THURSDAY_STORY,
        comp_questions=THURSDAY_COMP_QUESTIONS,
        sentence_sort_data=THURSDAY_SORT_DATA,
        detective_words=THURSDAY_DETECTIVE,
        swap_data=THURSDAY_SWAP_DATA,
        map_word=THURSDAY_MAP_WORD,
        para_prompts=THURSDAY_PARA_PROMPTS,
        story_prompt=THURSDAY_STORY_PROMPT,
        context_clue_writing=THURSDAY_CONTEXT_CLUE_WRITING,
        fix_paragraph=THURSDAY_FIX_PARAGRAPH,
    )

    # Friday
    generate_friday(
        week_dir=week_dir,
        week_num=week_num,
        phonics_label=PHONICS_LABEL,
        words=W3,
        review_story=FRIDAY_REVIEW_STORY,
        story_questions=FRIDAY_STORY_QUESTIONS,
        opposite_words=FRIDAY_OPPOSITE_WORDS,
        builder_words=FRIDAY_BUILDER_WORDS,
        journal_words=FRIDAY_JOURNAL_WORDS,
        guess_meaning=FRIDAY_GUESS_MEANING,
        paragraph_parts_review=FRIDAY_PARAGRAPH_PARTS_REVIEW,
    )

    # Teacher Guide — use full 4-tuple WORDS (teacher guide only accesses w[0] and w[2])
    generate_teacher_guide(
        week_dir=week_dir,
        week_num=week_num,
        phonics_label=PHONICS_LABEL,
        words=WORDS,
        # Monday
        monday_phonics_explanation=TEACHER_MONDAY_PHONICS_EXPLANATION,
        monday_grammar_focus=TEACHER_MONDAY_GRAMMAR_FOCUS,
        monday_grammar_explanation=TEACHER_MONDAY_GRAMMAR_EXPLANATION,
        monday_story_text=MONDAY_STORY,
        monday_sort_labels=MONDAY_SORT_LABELS,
        monday_sort_answers=[
            TEACHER_MONDAY_SORT_ANSWERS.get(label, [])
            for label in MONDAY_SORT_LABELS
        ],
        monday_fill_answers=["mysterious", "tiny", "fragile"],
        monday_opposite_answers=TEACHER_MONDAY_OPPOSITE_ANSWERS,
        monday_sentence_words=MONDAY_SENTENCE_WORDS,
        monday_context_clue_answers=[
            (sentence, word) for sentence, word in MONDAY_CONTEXT_CLUE_SENTENCES
        ],
        # Tuesday
        tuesday_phonics_explanation=TEACHER_TUESDAY_PHONICS_EXPLANATION,
        tuesday_scramble_answers=TEACHER_TUESDAY_SCRAMBLE_ANSWERS,
        tuesday_comp_questions=TUESDAY_COMP_QUESTIONS,
        tuesday_comp_answers=TEACHER_TUESDAY_COMP_ANSWERS,
        tuesday_pattern_hunt_answers=TEACHER_TUESDAY_PATTERN_HUNT,
        tuesday_swap_answers=TEACHER_THURSDAY_SWAP_ANSWERS,
        tuesday_builder_prompts=TUESDAY_BUILDER_PROMPTS,
        tuesday_paragraph_example=TUESDAY_PARAGRAPH_EXAMPLE,
        # Wednesday
        wednesday_phonics_explanation=TEACHER_WEDNESDAY_PHONICS_EXPLANATION,
        wednesday_vocab_q_question=TEACHER_WEDNESDAY_VOCAB_Q_QUESTION,
        wednesday_vocab_q_answer=TEACHER_WEDNESDAY_VOCAB_Q_ANSWER,
        wednesday_syn_ant_words=WEDNESDAY_SYN_ANT,
        wednesday_word_web_center=WEDNESDAY_WORD_WEB_CENTER,
        wednesday_word_web_suggestions=[
            "Definition", "Example", "Contrast", "Description",
            "surrounding words", "hints", "meaning"
        ],
        wednesday_sort_answers=TEACHER_WEDNESDAY_SORT_ANSWERS,
        wednesday_correct_answers=TEACHER_WEDNESDAY_CORRECT_ANSWERS,
        wednesday_fill_answers=TEACHER_WEDNESDAY_FILL_ANSWERS,
        wednesday_context_clue_question=TEACHER_WEDNESDAY_VOCAB_Q_QUESTION,
        wednesday_context_clue_answer=TEACHER_WEDNESDAY_VOCAB_Q_ANSWER,
        wednesday_dictation_words=TEACHER_WEDNESDAY_DICTATION_WORDS,
        wednesday_context_clue_detective_answers=TEACHER_WEDNESDAY_DETECTIVE_ANSWERS,
        wednesday_paragraph_label_answers=TEACHER_WEDNESDAY_PARAGRAPH_LABEL_ANSWERS,
        # Thursday
        thursday_phonics_explanation=TEACHER_THURSDAY_PHONICS_EXPLANATION,
        thursday_comp_questions=THURSDAY_COMP_QUESTIONS,
        thursday_comp_answers=TEACHER_THURSDAY_COMP_ANSWERS,
        thursday_sort_answers=TEACHER_THURSDAY_SORT_ANSWERS,
        thursday_detective_answers=TEACHER_THURSDAY_DETECTIVE_ANSWERS,
        thursday_swap_answers=TEACHER_THURSDAY_SWAP_ANSWERS,
        thursday_map_word=THURSDAY_MAP_WORD,
        thursday_map_suggestions=TEACHER_THURSDAY_MAP_SUGGESTIONS,
        thursday_para_prompts=THURSDAY_PARA_PROMPTS,
        thursday_context_clue_words=THURSDAY_CONTEXT_CLUE_WRITING,
        thursday_fix_paragraph_topic=TEACHER_THURSDAY_FIX_TOPIC,
        thursday_fix_paragraph_conclusion=TEACHER_THURSDAY_FIX_CONCLUSION,
        # Friday
        friday_phonics_explanation=TEACHER_FRIDAY_PHONICS_EXPLANATION,
        friday_test_answers=[w[0] for w in WORDS],
        friday_story_questions=FRIDAY_STORY_QUESTIONS,
        friday_story_answers=TEACHER_FRIDAY_STORY_ANSWERS,
        friday_opposite_answers=TEACHER_FRIDAY_OPPOSITE_ANSWERS,
        friday_builder_words=FRIDAY_BUILDER_WORDS,
        friday_journal_words=FRIDAY_JOURNAL_WORDS,
        friday_guess_answers=TEACHER_FRIDAY_GUESS_ANSWERS,
        friday_paragraph_answers=TEACHER_FRIDAY_PARAGRAPH_ANSWERS,
    )


if __name__ == "__main__":
    import argparse
    ap = argparse.ArgumentParser()
    ap.add_argument("--week-dir", default=WEEK)
    ap.add_argument("--week-num", type=int, default=18)
    args = ap.parse_args()

    print(f"Generating Week {args.week_num}: Context Clues & Paragraph Structure")
    print(f"  Using shared module system (monday.py, tuesday.py, etc.)")
    generate(week_dir=args.week_dir, week_num=args.week_num)
    print("Done.")
