from __future__ import annotations

from pydantic import BaseModel


class Node(BaseModel):
    id: int
    termType: str  # "uri" | "bnode"
    iri: str
    label: str | None = None


class Edge(BaseModel):
    source: int
    target: int
    predicate: str


class StatsResponse(BaseModel):
    backend: str
    ttl_path: str
    sparql_endpoint: str | None = None
    parsed_triples: int
    nodes: int
    edges: int


class NodesResponse(BaseModel):
    total: int
    nodes: list[Node]


class EdgesResponse(BaseModel):
    total: int
    edges: list[Edge]


class GraphResponse(BaseModel):
    nodes: list[Node]
    edges: list[Edge]


class SparqlQueryRequest(BaseModel):
    query: str
