from __future__ import annotations

from datetime import datetime
from typing import List

from pydantic import BaseModel, Field


class NavigationLinkSchema(BaseModel):
    id: int
    label: str
    href: str
    match_prefix: str | None = Field(default=None)
    icon: str | None = Field(default=None)
    tooltip: str | None = Field(default=None)
    is_external: bool = Field(default=False)
    children: List["NavigationLinkSchema"] = Field(default_factory=list)


class NavigationGroupSchema(BaseModel):
    id: int
    label: str
    icon: str | None = Field(default=None)
    tooltip: str | None = Field(default=None)
    links: List[NavigationLinkSchema] = Field(default_factory=list)


class NavigationSidebarResponse(BaseModel):
    groups: List[NavigationGroupSchema]
    roles: List[str] = Field(default_factory=list)
    generated_at: datetime


NavigationLinkSchema.model_rebuild()
NavigationGroupSchema.model_rebuild()
NavigationSidebarResponse.model_rebuild()
