#!/usr/bin/env python3
"""
Serdarli Primary School — English Weekly Lesson Plan
WEEK 3 : 28 September - 2 October 2026
Format matches the Week 1 / Week 2 plans exactly. All content in English.
Unit 1 consolidation week for all grades.
"""

from docx import Document
from docx.shared import Pt, Cm, RGBColor
from docx.enum.table import WD_TABLE_ALIGNMENT
from docx.enum.section import WD_ORIENT

DATE_RANGE = "28 September - 2 October 2026"

# (Grade, Learning Area, Learning Outcome, Activities and Content, Key Concepts/Skills)
HAFTA3 = [
    (
        "Grade 2",
        "My Classroom",
        [
            "Counts and writes numbers 11-20",
            "Names eleven colours and describes objects with them",
            "Forms simple plurals with '-s'",
            "Names shapes: circle, square, triangle, star, heart",
        ],
        [
            "Numbers 11-20: eleven, twelve, thirteen ... twenty; counting classroom objects",
            "Colours (11): red, blue, green, yellow, orange, purple, pink, brown, black, white, grey",
            "Plurals: 'one book - two books', 'one pen - two pens'",
            "Shapes: circle, square, triangle, star, heart - 'It is a circle.'",
            "Review Unit 1: greetings, classroom objects, 'It is a ___.', 'I am ___.'",
            "IW: Colour, count and label classroom objects",
            "GW: Shapes and colours matching game",
            "WCA: Numbers Bingo (11-20), Simon Says, Unit 1 song",
        ],
        "Numbers 11-20 / Colours / Plurals / Shapes / Unit 1 review",
    ),
    (
        "Grade 3",
        "My Classroom",
        [
            "Counts and spells numbers 1-20 accurately",
            "Names classroom objects and describes them with this / that",
            "Forms questions and short answers with verb to be",
            "Expresses possession using 'I have got ___'",
        ],
        [
            "Numbers 1-20: counting, spelling and writing",
            "Classroom objects review: book, pencil, pen, ruler, rubber, table, chair, board, window, door",
            "Verb to be: 'Is this a ruler?' 'Yes, it is.' / 'No, it isn't.'",
            "Demonstratives: 'This is a pencil case.' / 'That is a board.'",
            "'I have got a pencil.' / 'I have got two books.'",
            "IW: Complete a classroom objects word puzzle",
            "PW: Ask and answer about classroom objects",
            "WCA: Spelling Bee, Bingo, Simon Says, Unit 1 song",
        ],
        "Numbers 1-20 / Classroom objects / Verb to be (questions) / this-that / I have got",
    ),
    (
        "Grade 4",
        "My School",
        [
            "Describes ongoing actions using Present Continuous Tense",
            "Talks about school subjects and a weekly timetable",
            "Describes the classroom using There is / There are",
            "Uses possessive adjectives and 's to talk about school items",
        ],
        [
            "Present Continuous review: 'I am reading.', 'She is writing.' / 'What is he doing?'",
            "School subjects: English, Maths, Science, Music, Art, PE",
            "Weekdays + timetable: 'On Monday I have English.'",
            "There is / There are: 'There is a board.', 'There are twenty desks.'",
            "Possessive adjectives + 's: 'my book', 'Niyazi's pencil'",
            "Asking for permission: 'Can I go out, please?' / 'May I use your pencil?'",
            "GW: School Day Activities - present what others are doing",
            "IW: Complete a weekly timetable with school subjects",
            "WCA: Classroom activities song, Unit 1 review game",
        ],
        "Present Continuous / Wh-questions / Timetable / There is-are / Possessives",
    ),
    (
        "Grade 5",
        "My Day",
        [
            "Describes daily routines using Present Simple Tense (to be)",
            "Uses object pronouns (me, you, him, her, it, us, them)",
            "Uses before / after to talk about daily routines",
            "Names and labels body parts",
        ],
        [
            "Daily routines review: get up, have breakfast, get dressed, brush teeth, go to school, do homework, go to bed",
            "Present Simple (to be): 'I am at school.', 'She is happy.', 'Are you ready?'",
            "Object pronouns: 'Tell me.', 'Help him.', 'I like her.', 'Give it to us.'",
            "Time expressions: o'clock, half past, before school, after dinner",
            "'I get up before school.' / 'I do my homework after dinner.'",
            "Body parts + song 'Head and Shoulders'",
            "PW: Exchange information to complete a weekly lesson programme",
            "IW: Write a short text about daily life (before and after)",
            "GW: Create a robot, label its body parts and present it",
        ],
        "Present Simple to be / Object pronouns / Before-after / Daily routines / Body parts",
    ),
]


def create_plan():
    doc = Document()

    for section in doc.sections:
        new_width, new_height = section.page_height, section.page_width
        section.orientation = WD_ORIENT.LANDSCAPE
        section.page_width = new_width
        section.page_height = new_height
        section.top_margin = Cm(2.0)
        section.bottom_margin = Cm(2.0)
        section.left_margin = Cm(2.0)
        section.right_margin = Cm(2.0)

    style = doc.styles['Normal']
    style.font.name = 'Arial'
    style.font.size = Pt(11)

    # Title
    p1 = doc.add_paragraph()
    run = p1.add_run("\tSERDARLI PRIMARY SCHOOL\t" + DATE_RANGE)
    run.bold = True
    run.font.name = 'Arial'

    p2 = doc.add_paragraph()
    run = p2.add_run("\tENGLISH LESSON WEEKLY PLAN")
    run.bold = True
    run.font.name = 'Arial'

    doc.add_paragraph()

    headers = [
        "Grade Level",
        "Learning Area",
        "Learning Outcome",
        "Activities and Content",
        "Key Concepts / Skills",
    ]

    table = doc.add_table(rows=0, cols=5)
    table.style = 'Table Grid'
    table.alignment = WD_TABLE_ALIGNMENT.CENTER

    header_row = table.add_row()
    for i, h in enumerate(headers):
        cell = header_row.cells[i]
        cell.text = h
        for p in cell.paragraphs:
            for r in p.runs:
                r.bold = True
                r.font.name = 'Arial'
                r.font.size = Pt(11)
                r.font.color.rgb = RGBColor(0x1F, 0x1F, 0x1F)

    for row_data in HAFTA3:
        row = table.add_row()
        for i, val in enumerate(row_data):
            cell = row.cells[i]
            if isinstance(val, list):
                cell.text = ''
                for j, item in enumerate(val):
                    p = cell.paragraphs[0] if j == 0 else cell.add_paragraph()
                    p.style = doc.styles['List Bullet']
                    run = p.add_run(item)
                    run.font.name = 'Arial'
                    run.font.size = Pt(11)
            else:
                cell.text = val
                for p in cell.paragraphs:
                    for r in p.runs:
                        r.font.name = 'Arial'
                        r.font.size = Pt(11)

    doc.add_paragraph()

    p = doc.add_paragraph()
    run = p.add_run("Teacher:\t\tHeadteacher")
    run.font.name = 'Arial'

    p = doc.add_paragraph()
    run = p.add_run("Niyazi Coban  \t\tOzgul Dervisogullari")
    run.font.name = 'Arial'

    output = "/root/Akademik/İngilizce/Ingilizce_Haftalik_Plan_H3_28_Eylul-2_Ekim.docx"
    doc.save(output)
    print(f"Saved: {output}")
    return output


if __name__ == "__main__":
    create_plan()
