"""
Products Frontend Views
"""
from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates

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


@router.get("/products", response_class=HTMLResponse)
async def products_list(request: Request):
    return templates.TemplateResponse("products/frontend/list.html", {
        "request": request
    })


@router.get("/products/{product_id}", response_class=HTMLResponse)
async def product_detail(request: Request, product_id: int):
    return templates.TemplateResponse("products/frontend/detail.html", {
        "request": request,
        "product_id": product_id
    })
