"""Pydantic models for GA4GH Data Connect v1."""

from __future__ import annotations

from typing import Any

from ai4gh.core.types import GA4GHBase


class ColumnSchema(GA4GHBase):
    """Schema for a single column in a Data Connect table."""

    name: str
    data_type: str | None = None
    description: str | None = None
    is_nullable: bool | None = None
    ontology_term: str | None = None


class TableSchema(GA4GHBase):
    """Schema for a Data Connect table."""

    columns: list[ColumnSchema] | None = None
    ref: str | None = None
    description: str | None = None


class TableInfo(GA4GHBase):
    """Information about a Data Connect table."""

    name: str
    description: str | None = None
    data_model: TableSchema | None = None


class TableListResponse(GA4GHBase):
    """Response for listing tables."""

    tables: list[TableInfo] | None = None
    pagination: dict[str, Any] | None = None


class TableData(GA4GHBase):
    """Data returned from a table query."""

    data: list[dict[str, Any]] | None = None
    data_model: TableSchema | None = None
    pagination: dict[str, Any] | None = None


class SearchRequest(GA4GHBase):
    """Data Connect search request."""

    query: str
    page_size: int | None = None
    page_token: str | None = None
