"""
Frontend Views Router for Time Tracking Module
===============================================

HTML page handlers for time tracking UI.
"""

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

logger = logging.getLogger(__name__)

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


@router.get("/timetracking", response_class=HTMLResponse, name="timetracking_dashboard")
async def timetracking_dashboard(request: Request):
    """Time Tracking Dashboard - oversigt og sync"""
    return templates.TemplateResponse("timetracking/frontend/dashboard.html", {"request": request})


@router.get("/timetracking/wizard", response_class=HTMLResponse, name="timetracking_wizard")
async def timetracking_wizard(request: Request):
    """Time Tracking Wizard - step-by-step approval"""
    return templates.TemplateResponse("timetracking/frontend/wizard.html", {"request": request})


@router.get("/timetracking/wizard2", response_class=HTMLResponse, name="timetracking_wizard_v2")
async def timetracking_wizard_v2(request: Request):
    """Time Tracking Wizard V2 - simplified approval"""
    return templates.TemplateResponse("timetracking/frontend/wizard2.html", {"request": request})


@router.get("/timetracking/registrations", response_class=HTMLResponse, name="timetracking_registrations")
async def timetracking_registrations(request: Request):
    """Time Tracking Registrations - list view"""
    return templates.TemplateResponse("timetracking/frontend/registrations.html", {"request": request})


@router.get("/timetracking/customers", response_class=HTMLResponse, name="timetracking_customers")
async def timetracking_customers(request: Request):
    """Time Tracking Customers - manage hourly rates"""
    return templates.TemplateResponse("timetracking/frontend/customers.html", {"request": request})


@router.get("/timetracking/orders", response_class=HTMLResponse, name="timetracking_orders")
async def timetracking_orders(request: Request):
    """Order oversigt"""
    return templates.TemplateResponse("timetracking/frontend/orders.html", {"request": request})


@router.get("/timetracking/service-contract-wizard", response_class=HTMLResponse, name="service_contract_wizard")
async def service_contract_wizard(request: Request):
    """Service Contract Migration Wizard"""
    return templates.TemplateResponse("timetracking/frontend/service_contract_wizard.html", {"request": request})


@router.get("/timetracking/service-contract-report", response_class=HTMLResponse, name="service_contract_report")
async def service_contract_report(request: Request):
    """Service contract case/timelog report"""
    return templates.TemplateResponse("timetracking/frontend/service_contract_report.html", {"request": request})


@router.get("/timetracking/employee-log", response_class=HTMLResponse, name="timetracking_employee_log")
async def timetracking_employee_log(request: Request):
    """Employee time log with day/week/month gap overview"""
    return templates.TemplateResponse("timetracking/frontend/employee_log.html", {"request": request})
