#!/usr/bin/env python3
"""
Serdarli Primary School — English Weekly Lesson Plan
WEEK 2 : 21 - 25 September 2026
Format matches the Week 1 plan exactly. All content in English.
Grammar order per grade taken verbatim from the Year 3/4/5 curriculum PDFs.
"""

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 = "21 - 25 September 2026"

# (Grade, Learning Area, Learning Outcome, Activities and Content, Key Concepts/Skills)
HAFTA2 = [
    (
        "Grade 2",
        "My Classroom",
        [
            "Names more classroom objects (pen, board, ruler, rubber, table)",
            "Identifies objects using 'It is a ___'",
            "Counts 1-10 and answers 'How many ___?'",
            "Follows simple classroom instructions",
        ],
        [
            "Classroom objects (part 2): pen, board, ruler, rubber, table, window, door",
            "Structure: 'It is a pen.', 'It is a ruler.'",
            "Numbers 1-10: counting objects, 'How many pencils?'",
            "Colours review: 'It is a red pen.'",
            "IW: Colour and label classroom objects",
            "GW: Flashcards matching game",
            "WCA: Bingo (numbers 1-10), Simon Says (open your book, sit down)",
        ],
        "Classroom objects / It is a ___ / Numbers 1-10 / Colours / Instructions",
    ),
    (
        "Grade 3",
        "My Classroom",
        [
            "Forms inverted questions and short answers with verb to be",
            "Uses demonstratives this / that to point at objects",
            "Counts and spells numbers 1-20",
            "Expresses possessions using 'I have got ___'",
        ],
        [
            "Classroom objects (part 2): ruler, rubber, pencil case, table, window, door",
            "Inverted questions + short answers: 'Is this a ruler?' 'Yes, it is.' / 'No, it isn't.'",
            "Demonstratives: this / that",
            "'I have got a pencil.' / 'I have got two books.'",
            "Numbers 1-20: counting and spelling",
            "IW: Complete a simple classroom table / form",
            "PW: My Pencil Case display and naming the objects",
            "WCA: Bingo, Spelling Bee, Simon Says",
        ],
        "Verb to be (questions / short answers) / this-that / I have got / Numbers 1-20",
    ),
    (
        "Grade 4",
        "My School",
        [
            "Asks and answers about ongoing actions: 'What are you doing?' / 'What is he doing?'",
            "Describes the classroom using There is / There are",
            "Asks for permission using 'Can I ___ , please?' / 'May I ___?'",
        ],
        [
            "Present Continuous (affirmative / interrogative): 'What are you doing?' 'I am reading.'",
            "School subjects: English, Maths, Science, Music, Art, PE",
            "There is / There are: 'There is a board.', 'There are ten desks.'",
            "Asking for permission: 'Can I go out, please?', 'May I use your pencil?'",
            "Weekdays + timetable: writing simple phrases about own school subjects",
            "GW: School Day Activities (present what others are doing)",
            "IW: Complete a weekly timetable with subjects",
            "WCA: Classroom activities song",
        ],
        "Present Continuous / Wh-questions / There is-are / Permission / School subjects",
    ),
    (
        "Grade 5",
        "My Day",
        [
            "Uses object pronouns (me, you, him, her, it, us, them)",
            "Expresses daily routines using Present Simple Tense to be with time expressions",
            "Uses before / after to talk about when things happen",
        ],
        [
            "Daily routines (part 2): have breakfast, get dressed, brush teeth, go to school, do homework, go to bed",
            "Object pronouns: 'Tell me.', 'Help him.', 'I like her.'",
            "Time expressions: o'clock, half past, before school, after dinner",
            "'I get up before school.' / 'I do my homework after dinner.'",
            "Body parts review + 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",
        ],
        "Object pronouns / Present Simple to be / Before-after / Daily routines / Time",
    ),
]


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()

    # ─── Table ───
    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 HAFTA2:
        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)

    # ─── Signatures ───
    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_H2_21-25_Eylul.docx"
    doc.save(output)
    print(f"Saved: {output}")
    return output


if __name__ == "__main__":
    create_plan()
