"""
Email Frontend Views
Serves the email management UI
"""

from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates
import logging

logger = logging.getLogger(__name__)

router = APIRouter()

# Setup Jinja2 templates
templates = Jinja2Templates(directory="app")

@router.get("/emails", response_class=HTMLResponse)
async def emails_page(request: Request):
    """Email management UI - 3-column modern email interface"""
    return templates.TemplateResponse(
        "emails/frontend/emails.html",
        {"request": request, "email_ui_version": "v1"}
    )


@router.get("/emails/v1", response_class=HTMLResponse)
async def emails_page_v1(request: Request):
    """Email management UI v1 (legacy/stable)."""
    return templates.TemplateResponse(
        "emails/frontend/emails.html",
        {"request": request, "email_ui_version": "v1"}
    )


@router.get("/emails/v2", response_class=HTMLResponse)
async def emails_page_v2(request: Request):
    """Email management UI v2 (simplified workflow)."""
    return templates.TemplateResponse(
        "emails/frontend/emails_v2.html",
        {"request": request, "email_ui_version": "v2"}
    )
