# generated by datamodel-codegen:
#   filename:  catalog_v1.json

from __future__ import annotations

from typing import Any
from typing import Optional
from typing import Union

from pydantic import ConfigDict
from pydantic import Field

from vendor.dbt_artifacts_parser.parsers.base import BaseParserModel


class Metadata(BaseParserModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    dbt_schema_version: Optional[str] = None
    dbt_version: Optional[str] = "1.9.0b2"
    generated_at: Optional[str] = None
    invocation_id: Optional[str] = None
    env: Optional[dict[str, str]] = None


class Metadata1(BaseParserModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    type: str
    schema_: str = Field(..., alias="schema")
    name: str
    database: Optional[str] = None
    comment: Optional[str] = None
    owner: Optional[str] = None


class Columns(BaseParserModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    type: str
    index: int
    name: str
    comment: Optional[str] = None


class Stats(BaseParserModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    id: str
    label: str
    value: Optional[Union[bool, str, float]] = None
    include: bool
    description: Optional[str] = None


class Nodes(BaseParserModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    metadata: Metadata1 = Field(..., title="TableMetadata")
    columns: dict[str, Columns]
    stats: dict[str, Stats]
    unique_id: Optional[str] = None


class Sources(BaseParserModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    metadata: Metadata1 = Field(..., title="TableMetadata")
    columns: dict[str, Columns]
    stats: dict[str, Stats]
    unique_id: Optional[str] = None


class CatalogV1(BaseParserModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    metadata: Metadata = Field(..., title="CatalogMetadata")
    nodes: dict[str, Nodes]
    sources: dict[str, Sources]
    errors: Optional[list[str]] = None
    field_compile_results: Any = Field(None, alias="_compile_results")
