#!/usr/bin/env python3
"""Part 3: Deneme 3 (Zor) + Okuma 1 (Kolay)"""
from docx import Document
from docx.shared import Pt, Cm, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn

PATH = "/root/Akademik/İngilizce/5. Sınıf/Unit1_My_Day.docx"
doc = Document(PATH)

FONT = "Niramit"
BLUE = RGBColor(0x1a, 0x55, 0x9e)
DARK = RGBColor(0x22, 0x22, 0x22)
GRAY = RGBColor(0x66, 0x66, 0x66)

def run(p, text, size=11, bold=False, color=DARK, italic=False):
    r = p.add_run(text)
    r.font.name = FONT; r.font.size = Pt(size)
    r.bold = bold; r.font.color.rgb = color; r.italic = italic
    return r

def heading(text, sz=14):
    doc.add_page_break()
    p = doc.add_paragraph()
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    run(p, text, sz, True, BLUE)

def sub(text):
    p = doc.add_paragraph()
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    run(p, text, 10, False, GRAY, italic=True)

def section(text):
    p = doc.add_paragraph()
    p.paragraph_format.space_before = Pt(10)
    run(p, text, 12, True, BLUE)

def body(text):
    p = doc.add_paragraph()
    run(p, text, 10.5)

def add_q(num, stem, opts):
    doc.add_paragraph()
    p = doc.add_paragraph()
    p.paragraph_format.space_before = Pt(6)
    run(p, f"{num}. {stem}", 11, True)
    for o in opts:
        p2 = doc.add_paragraph()
        p2.paragraph_format.left_indent = Cm(1)
        p2.paragraph_format.space_before = Pt(1)
        p2.paragraph_format.space_after = Pt(1)
        run(p2, o, 10.5)

def passage_box(text, title=None):
    if title:
        p = doc.add_paragraph()
        run(p, title, 11, True, DARK)
    table = doc.add_table(rows=1, cols=1)
    cell = table.cell(0, 0)
    p = cell.paragraphs[0]
    r = p.add_run(text)
    r.font.name = FONT; r.font.size = Pt(11); r.italic = True
    shading = cell._element.get_or_add_tcPr()
    shd = shading.makeelement(qn('w:shd'), {qn('w:val'): 'clear', qn('w:color'): 'auto', qn('w:fill'): 'F5F8FC'})
    shading.append(shd)
    doc.add_paragraph()

# ================================================================
# DENEME 3 - ZOR (Trik Noktalar Odaklı)
# ================================================================
heading("DENEME 3 — ZOR")
sub("15 Soru  |  Süre: 20 Dakika  |  Trik Noktalar Odaklı")

add_q(1, "A: Is your mother at home?\n B: No. She _______ at work until 6 o'clock.",
    ["A) is", "B) am", "C) are", "D) be"])

add_q(2, "A: Are you and your brother ready?\n B: No, we _______ . We are still eating breakfast.",
    ["A) is", "B) aren't", "C) isn't", "D) not"])

add_q(3, "My sister and I _______ twins. _______ birthdays are in June.",
    ["A) are / Us", "B) is / Our", "C) are / Our", "D) am / We"])

add_q(4, "A: Is David a good student?\n B: Yes, _______ . He always does his homework.",
    ["A) he is", "B) he's", "C) he does", "D) he has"])

add_q(5, "Look at _______ ! She is dancing very well.",
    ["A) she", "B) her", "C) he", "D) him"])

add_q(6, "A: _______ is your English lesson?\n B: It is at 9 o'clock _______ the morning.",
    ["A) When / in", "B) What time / at", "C) What time / in", "D) When / at"])

add_q(7, "My brother is only 2 years old. I help _______ to brush _______ teeth.",
    ["A) him / his", "B) he / him", "C) her / his", "D) him / he"])

add_q(8, "A: Are your parents at home now?\n B: No, _______ . They are at work.",
    ["A) they aren't", "B) they are", "C) they isn't", "D) it isn't"])

add_q(9, "It is half past seven. I wake up at 7:30. I wake up _______ half past seven.",
    ["A) before", "B) at", "C) after", "D) in"])

add_q(10, "My father gets up _______ 6:30 but I get up _______ 7 o'clock.",
    ["A) at / at", "B) in / at", "C) at / in", "D) in / in"])

add_q(11, "A: What time is it?\n B: It is quarter _______ nine. (8:45)",
    ["A) past", "B) to", "C) after", "D) half"])

add_q(12, "I like my grandmother very much. I visit _______ every weekend.",
    ["A) she", "B) her", "C) him", "D) they"])

add_q(13, "My teacher gives _______ a lot of homework but I really like _______ .",
    ["A) we / she", "B) us / her", "C) our / him", "D) they / it"])

add_q(14, "A: What do you do _______ breakfast?\n B: I brush my teeth.",
    ["A) after", "B) before", "C) at", "D) in"])

add_q(15, "It is 8 o'clock. School starts at 8:30. School starts _______ 8 o'clock.",
    ["A) at", "B) before", "C) after", "D) in"])

# ================================================================
# OKUMA 1 - KOLAY
# ================================================================
heading("OKUMA 1 — KOLAY")
sub("Aşağıdaki metni okuyunuz. Soruları metne göre cevaplayınız.")

passage_box(
    "Hello! My name is Ayşe. I am 10 years old. I am a student. "
    "I live in Nicosia with my family. I wake up at 7 o'clock every morning. "
    "After I wake up, I wash my face and brush my teeth. "
    "Then, I have breakfast with my mother and father. "
    "I eat cereal and drink milk for breakfast. "
    "After breakfast, I get dressed and go to school. "
    "School starts at 8:30. I have lunch at 12 o'clock at school. "
    "I come home at 3 o'clock. Before dinner, I do my homework. "
    "I have dinner with my family at 7 o'clock. After dinner, I watch TV. "
    "I go to bed at 9 o'clock. I am very happy!",
    title="Ayşe's Day"
)

add_q(1, "How old is Ayşe?",
    ["A) 9", "B) 10", "C) 11", "D) 12"])

add_q(2, "What does Ayşe do after she wakes up?",
    ["A) She has breakfast.", "B) She goes to school.",
     "C) She washes her face and brushes her teeth.", "D) She gets dressed."])

add_q(3, "What time does school start?",
    ["A) At 7 o'clock", "B) At 8 o'clock", "C) At 8:30", "D) At 9 o'clock"])

add_q(4, "What does Ayşe do before dinner?",
    ["A) She watches TV.", "B) She does her homework.",
     "C) She has lunch.", "D) She goes to bed."])

add_q(5, "What time does Ayşe go to bed?",
    ["A) At 7 o'clock", "B) At 8 o'clock", "C) At 9 o'clock", "D) At 10 o'clock"])

doc.save(PATH)
print("✅ Part 3 eklendi: Deneme 3 (Zor) + Okuma 1 (Kolay)")
