"""UKO (Unified Knowledge Ontology) domain models.

Pydantic v2 value objects representing the parsed UKO ontology structure:
namespace prefixes, ontology nodes (classes and properties), version
metadata, and the top-level ontology container.

All models use ``frozen=True`` for immutability as required by ADR-004.
"""

from __future__ import annotations

from pydantic import BaseModel, Field


class UKOPrefix(BaseModel, frozen=True):
    """A namespace prefix mapping."""

    prefix: str
    uri: str


class UKONode(BaseModel, frozen=True):
    """A node in the UKO ontology."""

    uri: str
    rdf_type: str  # e.g. "owl:Class" or "owl:ObjectProperty"
    label: str = ""
    comment: str = ""
    parent_uris: tuple[str, ...] = ()  # rdfs:subClassOf targets (multi-parent)
    layer: int = Field(ge=0, le=3, default=0)
    properties: tuple[tuple[str, str], ...] = ()  # immutable key-value pairs


class UKOVersion(BaseModel, frozen=True):
    """Ontology version metadata."""

    version_iri: str
    version: str  # e.g. "0.1.0"
    label: str
    comment: str


class UKOOntology(BaseModel, frozen=True):
    """Parsed UKO ontology."""

    version: UKOVersion
    prefixes: tuple[UKOPrefix, ...] = ()
    nodes: tuple[UKONode, ...] = ()
    supported_versions: tuple[str, ...] = ("0.1.0",)
