# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .building_object_field import BuildingObjectField
from .building_object_type import BuildingObjectType
from .quality_annotation import QualityAnnotation


class FlatBuildingObject(UniversalBaseModel):
    """
    A single building object in a flat list. Use parentName to express hierarchy. Order objects parents-first (haus → wohnung → raum → bauobjekt).
    """

    name: str = pydantic.Field()
    """
    Object name, e.g. 'Hauptgebaeude', 'Schlafzimmer'
    """

    type: BuildingObjectType
    parent_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="parentName"),
        pydantic.Field(alias="parentName", description="Name of the parent object; null for root objects."),
    ] = None
    fields: typing.Optional[typing.List[BuildingObjectField]] = None
    quality_annotations: typing_extensions.Annotated[
        typing.Optional[typing.List[QualityAnnotation]],
        FieldMetadata(alias="qualityAnnotations"),
        pydantic.Field(
            alias="qualityAnnotations", description="Quality check annotations, set during Qualitätsprüfung phase."
        ),
    ] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
