"""
Meetings Module

Modular structure for the Meetings frontend.
Jitsi Meet Integration for video conferences, trainings, and parent-teacher meetings.

Modular Refactoring (2026-02-03):
- Split into sub-modules for maintainability
- Original file: meetings.py (2,639 lines)
- Now split into: styles.py, templates.py, pages/
"""

from fastapi import APIRouter
from fastapi.responses import HTMLResponse

from .pages import (
    meetings_dashboard,
    meeting_room,
    active_meetings,
    schedule_meetings,
    trainings_page,
    recordings_page,
    play_recording,
    view_transcript,
    breakout_rooms_page,
    quick_meeting,
    parent_teacher_meeting,
)

router = APIRouter()


# ============================================
# API Routes
# ============================================

@router.get("/meetings", response_class=HTMLResponse)
def get_meetings_dashboard():
    """Main meetings dashboard"""
    return meetings_dashboard()


@router.get("/meetings/room/{room_name}", response_class=HTMLResponse)
def get_meeting_room(room_name: str):
    """Meeting room with embedded Jitsi"""
    return meeting_room(room_name)


@router.get("/meetings/active", response_class=HTMLResponse)
def get_active_meetings():
    """Active meetings list"""
    return active_meetings()


@router.get("/meetings/schedule", response_class=HTMLResponse)
def get_schedule_meetings():
    """Schedule and manage upcoming meetings"""
    return schedule_meetings()


@router.get("/meetings/trainings", response_class=HTMLResponse)
def get_trainings_page():
    """Training sessions management"""
    return trainings_page()


@router.get("/meetings/recordings", response_class=HTMLResponse)
def get_recordings_page():
    """Recordings and transcripts management"""
    return recordings_page()


@router.get("/meetings/breakout", response_class=HTMLResponse)
def get_breakout_rooms_page():
    """Breakout rooms management"""
    return breakout_rooms_page()


@router.get("/meetings/quick", response_class=HTMLResponse)
def get_quick_meeting():
    """Start a quick meeting immediately"""
    return quick_meeting()


@router.get("/meetings/parent-teacher", response_class=HTMLResponse)
def get_parent_teacher_meeting():
    """Create a parent-teacher meeting"""
    return parent_teacher_meeting()


@router.get("/meetings/recordings/{recording_id}/play", response_class=HTMLResponse)
def get_play_recording(recording_id: str):
    """Play a recording"""
    return play_recording(recording_id)


@router.get("/meetings/recordings/{recording_id}/transcript", response_class=HTMLResponse)
def get_view_transcript(recording_id: str):
    """View recording transcript"""
    return view_transcript(recording_id)


__all__ = [
    "router",
]
