"""
Contact view routes for rendering HTML pages
"""
from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates

router = APIRouter()
templates = Jinja2Templates(directory="app")


@router.get("/contacts", response_class=HTMLResponse)
async def contacts_page(request: Request):
    """
    Render the contacts list page
    """
    return templates.TemplateResponse("contacts/frontend/contacts.html", {"request": request})


@router.get("/contacts/{contact_id}", response_class=HTMLResponse)
async def contact_detail_page(request: Request, contact_id: int):
    """
    Render the contact detail page
    """
    return templates.TemplateResponse("contacts/frontend/contact_detail.html", {
        "request": request,
        "contact_id": contact_id
    })
