# Generated by ORMatic

from __future__ import annotations
from sqlalchemy import (
    Column,
    ForeignKey,
    Integer,
    String,
    Float,
    Boolean,
    DateTime,
    Enum,
    JSON,
)
from sqlalchemy.orm import relationship, Mapped, mapped_column, DeclarativeBase

import builtins
import krrood.entity_query_language.orm.model
import krrood.entity_query_language.predicate
import krrood.entity_query_language.symbol_graph
import semantic_digital_twin.datastructures.prefixed_name
import semantic_digital_twin.orm.model
import semantic_digital_twin.robots.abstract_robot
import semantic_digital_twin.semantic_annotations.semantic_annotations
import semantic_digital_twin.world_description.connections
import semantic_digital_twin.world_description.geometry
import semantic_digital_twin.world_description.shape_collection
import semantic_digital_twin.world_description.world_entity
import typing
import typing_extensions


from krrood.ormatic.dao import DataAccessObject
from krrood.ormatic.custom_types import TypeType


class Base(DeclarativeBase):
    type_mappings = {}


class BoundingBoxDAO(
    Base, DataAccessObject[semantic_digital_twin.world_description.geometry.BoundingBox]
):

    __tablename__ = "BoundingBoxDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    min_x: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    min_y: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    min_z: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    max_x: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    max_y: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    max_z: Mapped[builtins.float] = mapped_column(use_existing_column=True)

    origin_id: Mapped[int] = mapped_column(
        ForeignKey("TransformationMatrixMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    origin: Mapped[TransformationMatrixMappingDAO] = relationship(
        "TransformationMatrixMappingDAO",
        uselist=False,
        foreign_keys=[origin_id],
        post_update=True,
    )


class CollisionCheckingConfigDAO(
    Base,
    DataAccessObject[
        semantic_digital_twin.world_description.world_entity.CollisionCheckingConfig
    ],
):

    __tablename__ = "CollisionCheckingConfigDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    buffer_zone_distance: Mapped[typing.Optional[builtins.float]] = mapped_column(
        use_existing_column=True
    )
    violated_distance: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    disabled: Mapped[typing.Optional[builtins.bool]] = mapped_column(
        use_existing_column=True
    )
    max_avoided_bodies: Mapped[builtins.int] = mapped_column(use_existing_column=True)


class ColorDAO(
    Base, DataAccessObject[semantic_digital_twin.world_description.geometry.Color]
):

    __tablename__ = "ColorDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    R: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    G: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    B: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    A: Mapped[builtins.float] = mapped_column(use_existing_column=True)


class FieldOfViewDAO(
    Base, DataAccessObject[semantic_digital_twin.robots.abstract_robot.FieldOfView]
):

    __tablename__ = "FieldOfViewDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    vertical_angle: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    horizontal_angle: Mapped[builtins.float] = mapped_column(use_existing_column=True)


class HasDoorsDAO(
    Base,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.HasDoors
    ],
):

    __tablename__ = "HasDoorsDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    doors: Mapped[typing.List[DoorDAO]] = relationship(
        "DoorDAO", foreign_keys="[DoorDAO.hasdoorsdao_doors_id]", post_update=True
    )


class HasDrawersDAO(
    Base,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.HasDrawers
    ],
):

    __tablename__ = "HasDrawersDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    drawers: Mapped[typing.List[DrawerDAO]] = relationship(
        "DrawerDAO",
        foreign_keys="[DrawerDAO.hasdrawersdao_drawers_id]",
        post_update=True,
    )


class Point3MappingDAO(
    Base, DataAccessObject[semantic_digital_twin.orm.model.Point3Mapping]
):

    __tablename__ = "Point3MappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    x: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    y: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    z: Mapped[builtins.float] = mapped_column(use_existing_column=True)

    reference_frame_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("KinematicStructureEntityDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    reference_frame: Mapped[KinematicStructureEntityDAO] = relationship(
        "KinematicStructureEntityDAO",
        uselist=False,
        foreign_keys=[reference_frame_id],
        post_update=True,
    )


class PredicateClassRelationDAO(
    Base,
    DataAccessObject[krrood.entity_query_language.symbol_graph.PredicateClassRelation],
):

    __tablename__ = "PredicateClassRelationDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    inferred: Mapped[builtins.bool] = mapped_column(use_existing_column=True)

    source_id: Mapped[int] = mapped_column(
        ForeignKey("WrappedInstanceMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    target_id: Mapped[int] = mapped_column(
        ForeignKey("WrappedInstanceMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    predicate_id: Mapped[int] = mapped_column(
        ForeignKey("BinaryPredicateDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    symbolgraphmappingdao_predicate_relations_id: Mapped[
        typing.Optional[builtins.int]
    ] = mapped_column(
        ForeignKey("SymbolGraphMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    source: Mapped[WrappedInstanceMappingDAO] = relationship(
        "WrappedInstanceMappingDAO",
        uselist=False,
        foreign_keys=[source_id],
        post_update=True,
    )
    target: Mapped[WrappedInstanceMappingDAO] = relationship(
        "WrappedInstanceMappingDAO",
        uselist=False,
        foreign_keys=[target_id],
        post_update=True,
    )
    predicate: Mapped[BinaryPredicateDAO] = relationship(
        "BinaryPredicateDAO",
        uselist=False,
        foreign_keys=[predicate_id],
        post_update=True,
    )


class QuaternionMappingDAO(
    Base, DataAccessObject[semantic_digital_twin.orm.model.QuaternionMapping]
):

    __tablename__ = "QuaternionMappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    x: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    y: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    z: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    w: Mapped[builtins.float] = mapped_column(use_existing_column=True)

    reference_frame_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("KinematicStructureEntityDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    reference_frame: Mapped[KinematicStructureEntityDAO] = relationship(
        "KinematicStructureEntityDAO",
        uselist=False,
        foreign_keys=[reference_frame_id],
        post_update=True,
    )


class RotationMatrixMappingDAO(
    Base, DataAccessObject[semantic_digital_twin.orm.model.RotationMatrixMapping]
):

    __tablename__ = "RotationMatrixMappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    rotation_id: Mapped[int] = mapped_column(
        ForeignKey("QuaternionMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    reference_frame_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("KinematicStructureEntityDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    rotation: Mapped[QuaternionMappingDAO] = relationship(
        "QuaternionMappingDAO",
        uselist=False,
        foreign_keys=[rotation_id],
        post_update=True,
    )
    reference_frame: Mapped[KinematicStructureEntityDAO] = relationship(
        "KinematicStructureEntityDAO",
        uselist=False,
        foreign_keys=[reference_frame_id],
        post_update=True,
    )


class ScaleDAO(
    Base, DataAccessObject[semantic_digital_twin.world_description.geometry.Scale]
):

    __tablename__ = "ScaleDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    x: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    y: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    z: Mapped[builtins.float] = mapped_column(use_existing_column=True)


class ShapeDAO(
    Base, DataAccessObject[semantic_digital_twin.world_description.geometry.Shape]
):

    __tablename__ = "ShapeDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    polymorphic_type: Mapped[str] = mapped_column(
        String(255), nullable=False, use_existing_column=True
    )

    origin_id: Mapped[int] = mapped_column(
        ForeignKey("TransformationMatrixMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    color_id: Mapped[int] = mapped_column(
        ForeignKey("ColorDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    shapecollectiondao_shapes_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("ShapeCollectionDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    origin: Mapped[TransformationMatrixMappingDAO] = relationship(
        "TransformationMatrixMappingDAO",
        uselist=False,
        foreign_keys=[origin_id],
        post_update=True,
    )
    color: Mapped[ColorDAO] = relationship(
        "ColorDAO", uselist=False, foreign_keys=[color_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_on": "polymorphic_type",
        "polymorphic_identity": "ShapeDAO",
    }


class BoxDAO(
    ShapeDAO, DataAccessObject[semantic_digital_twin.world_description.geometry.Box]
):

    __tablename__ = "BoxDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ShapeDAO.database_id), primary_key=True, use_existing_column=True
    )

    scale_id: Mapped[int] = mapped_column(
        ForeignKey("ScaleDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    scale: Mapped[ScaleDAO] = relationship(
        "ScaleDAO", uselist=False, foreign_keys=[scale_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "BoxDAO",
        "inherit_condition": database_id == ShapeDAO.database_id,
    }


class CylinderDAO(
    ShapeDAO,
    DataAccessObject[semantic_digital_twin.world_description.geometry.Cylinder],
):

    __tablename__ = "CylinderDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ShapeDAO.database_id), primary_key=True, use_existing_column=True
    )

    width: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    height: Mapped[builtins.float] = mapped_column(use_existing_column=True)

    __mapper_args__ = {
        "polymorphic_identity": "CylinderDAO",
        "inherit_condition": database_id == ShapeDAO.database_id,
    }


class MeshDAO(
    ShapeDAO, DataAccessObject[semantic_digital_twin.world_description.geometry.Mesh]
):

    __tablename__ = "MeshDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ShapeDAO.database_id), primary_key=True, use_existing_column=True
    )

    scale_id: Mapped[int] = mapped_column(
        ForeignKey("ScaleDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    scale: Mapped[ScaleDAO] = relationship(
        "ScaleDAO", uselist=False, foreign_keys=[scale_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "MeshDAO",
        "inherit_condition": database_id == ShapeDAO.database_id,
    }


class FileMeshDAO(
    MeshDAO, DataAccessObject[semantic_digital_twin.world_description.geometry.FileMesh]
):

    __tablename__ = "FileMeshDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(MeshDAO.database_id), primary_key=True, use_existing_column=True
    )

    filename: Mapped[builtins.str] = mapped_column(use_existing_column=True)

    __mapper_args__ = {
        "polymorphic_identity": "FileMeshDAO",
        "inherit_condition": database_id == MeshDAO.database_id,
    }


class ShapeCollectionDAO(
    Base,
    DataAccessObject[
        semantic_digital_twin.world_description.shape_collection.ShapeCollection
    ],
):

    __tablename__ = "ShapeCollectionDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    polymorphic_type: Mapped[str] = mapped_column(
        String(255), nullable=False, use_existing_column=True
    )

    reference_frame_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("KinematicStructureEntityDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    shapes: Mapped[typing.List[ShapeDAO]] = relationship(
        "ShapeDAO",
        foreign_keys="[ShapeDAO.shapecollectiondao_shapes_id]",
        post_update=True,
    )
    reference_frame: Mapped[KinematicStructureEntityDAO] = relationship(
        "KinematicStructureEntityDAO",
        uselist=False,
        foreign_keys=[reference_frame_id],
        post_update=True,
    )

    __mapper_args__ = {
        "polymorphic_on": "polymorphic_type",
        "polymorphic_identity": "ShapeCollectionDAO",
    }


class BoundingBoxCollectionDAO(
    ShapeCollectionDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.shape_collection.BoundingBoxCollection
    ],
):

    __tablename__ = "BoundingBoxCollectionDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ShapeCollectionDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "BoundingBoxCollectionDAO",
        "inherit_condition": database_id == ShapeCollectionDAO.database_id,
    }


class SphereDAO(
    ShapeDAO, DataAccessObject[semantic_digital_twin.world_description.geometry.Sphere]
):

    __tablename__ = "SphereDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ShapeDAO.database_id), primary_key=True, use_existing_column=True
    )

    radius: Mapped[builtins.float] = mapped_column(use_existing_column=True)

    __mapper_args__ = {
        "polymorphic_identity": "SphereDAO",
        "inherit_condition": database_id == ShapeDAO.database_id,
    }


class SymbolDAO(Base, DataAccessObject[krrood.entity_query_language.predicate.Symbol]):

    __tablename__ = "SymbolDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    polymorphic_type: Mapped[str] = mapped_column(
        String(255), nullable=False, use_existing_column=True
    )

    __mapper_args__ = {
        "polymorphic_on": "polymorphic_type",
        "polymorphic_identity": "SymbolDAO",
    }


class PredicateDAO(
    SymbolDAO, DataAccessObject[krrood.entity_query_language.predicate.Predicate]
):

    __tablename__ = "PredicateDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SymbolDAO.database_id), primary_key=True, use_existing_column=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "PredicateDAO",
        "inherit_condition": database_id == SymbolDAO.database_id,
    }


class BinaryPredicateDAO(
    PredicateDAO,
    DataAccessObject[krrood.entity_query_language.predicate.BinaryPredicate],
):

    __tablename__ = "BinaryPredicateDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(PredicateDAO.database_id), primary_key=True, use_existing_column=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "BinaryPredicateDAO",
        "inherit_condition": database_id == PredicateDAO.database_id,
    }


class PrefixedNameDAO(
    SymbolDAO,
    DataAccessObject[semantic_digital_twin.datastructures.prefixed_name.PrefixedName],
):

    __tablename__ = "PrefixedNameDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SymbolDAO.database_id), primary_key=True, use_existing_column=True
    )

    name: Mapped[builtins.str] = mapped_column(use_existing_column=True)
    prefix: Mapped[typing.Optional[builtins.str]] = mapped_column(
        use_existing_column=True
    )

    worldstatemappingdao_names_id: Mapped[typing.Optional[builtins.int]] = (
        mapped_column(
            ForeignKey("WorldStateMappingDAO.database_id", use_alter=True),
            nullable=True,
            use_existing_column=True,
        )
    )

    __mapper_args__ = {
        "polymorphic_identity": "PrefixedNameDAO",
        "inherit_condition": database_id == SymbolDAO.database_id,
    }


class SymbolGraphMappingDAO(
    Base, DataAccessObject[krrood.entity_query_language.orm.model.SymbolGraphMapping]
):

    __tablename__ = "SymbolGraphMappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    instances: Mapped[typing.List[WrappedInstanceMappingDAO]] = relationship(
        "WrappedInstanceMappingDAO",
        foreign_keys="[WrappedInstanceMappingDAO.symbolgraphmappingdao_instances_id]",
        post_update=True,
    )
    predicate_relations: Mapped[typing.List[PredicateClassRelationDAO]] = relationship(
        "PredicateClassRelationDAO",
        foreign_keys="[PredicateClassRelationDAO.symbolgraphmappingdao_predicate_relations_id]",
        post_update=True,
    )


class TransformationMatrixMappingDAO(
    Base, DataAccessObject[semantic_digital_twin.orm.model.TransformationMatrixMapping]
):

    __tablename__ = "TransformationMatrixMappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    position_id: Mapped[int] = mapped_column(
        ForeignKey("Point3MappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    rotation_id: Mapped[int] = mapped_column(
        ForeignKey("QuaternionMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    reference_frame_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("KinematicStructureEntityDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    child_frame_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("KinematicStructureEntityDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    position: Mapped[Point3MappingDAO] = relationship(
        "Point3MappingDAO", uselist=False, foreign_keys=[position_id], post_update=True
    )
    rotation: Mapped[QuaternionMappingDAO] = relationship(
        "QuaternionMappingDAO",
        uselist=False,
        foreign_keys=[rotation_id],
        post_update=True,
    )
    reference_frame: Mapped[KinematicStructureEntityDAO] = relationship(
        "KinematicStructureEntityDAO",
        uselist=False,
        foreign_keys=[reference_frame_id],
        post_update=True,
    )
    child_frame: Mapped[KinematicStructureEntityDAO] = relationship(
        "KinematicStructureEntityDAO",
        uselist=False,
        foreign_keys=[child_frame_id],
        post_update=True,
    )


class TriangleMeshDAO(
    MeshDAO,
    DataAccessObject[semantic_digital_twin.world_description.geometry.TriangleMesh],
):

    __tablename__ = "TriangleMeshDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(MeshDAO.database_id), primary_key=True, use_existing_column=True
    )

    mesh: Mapped[typing.Optional[semantic_digital_twin.orm.model.TrimeshType]] = (
        mapped_column(
            semantic_digital_twin.orm.model.TrimeshType,
            nullable=True,
            use_existing_column=True,
        )
    )

    __mapper_args__ = {
        "polymorphic_identity": "TriangleMeshDAO",
        "inherit_condition": database_id == MeshDAO.database_id,
    }


class Vector3MappingDAO(
    Base, DataAccessObject[semantic_digital_twin.orm.model.Vector3Mapping]
):

    __tablename__ = "Vector3MappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    x: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    y: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    z: Mapped[builtins.float] = mapped_column(use_existing_column=True)

    reference_frame_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("KinematicStructureEntityDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    reference_frame: Mapped[KinematicStructureEntityDAO] = relationship(
        "KinematicStructureEntityDAO",
        uselist=False,
        foreign_keys=[reference_frame_id],
        post_update=True,
    )


class WorldMappingDAO(
    Base, DataAccessObject[semantic_digital_twin.orm.model.WorldMapping]
):

    __tablename__ = "WorldMappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    name: Mapped[typing.Optional[builtins.str]] = mapped_column(
        use_existing_column=True
    )

    state_id: Mapped[int] = mapped_column(
        ForeignKey("WorldStateMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    kinematic_structure_entities: Mapped[typing.List[KinematicStructureEntityDAO]] = (
        relationship(
            "KinematicStructureEntityDAO",
            foreign_keys="[KinematicStructureEntityDAO.worldmappingdao_kinematic_structure_entities_id]",
            post_update=True,
        )
    )
    connections: Mapped[typing.List[ConnectionDAO]] = relationship(
        "ConnectionDAO",
        foreign_keys="[ConnectionDAO.worldmappingdao_connections_id]",
        post_update=True,
    )
    semantic_annotations: Mapped[typing.List[SemanticAnnotationDAO]] = relationship(
        "SemanticAnnotationDAO",
        foreign_keys="[SemanticAnnotationDAO.worldmappingdao_semantic_annotations_id]",
        post_update=True,
    )
    degrees_of_freedom: Mapped[typing.List[DegreeOfFreedomMappingDAO]] = relationship(
        "DegreeOfFreedomMappingDAO",
        foreign_keys="[DegreeOfFreedomMappingDAO.worldmappingdao_degrees_of_freedom_id]",
        post_update=True,
    )
    state: Mapped[WorldStateMappingDAO] = relationship(
        "WorldStateMappingDAO", uselist=False, foreign_keys=[state_id], post_update=True
    )


class WorldEntityDAO(
    SymbolDAO,
    DataAccessObject[semantic_digital_twin.world_description.world_entity.WorldEntity],
):

    __tablename__ = "WorldEntityDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SymbolDAO.database_id), primary_key=True, use_existing_column=True
    )

    name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[name_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "WorldEntityDAO",
        "inherit_condition": database_id == SymbolDAO.database_id,
    }


class ConnectionDAO(
    WorldEntityDAO,
    DataAccessObject[semantic_digital_twin.world_description.world_entity.Connection],
):

    __tablename__ = "ConnectionDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(WorldEntityDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    worldmappingdao_connections_id: Mapped[typing.Optional[builtins.int]] = (
        mapped_column(
            ForeignKey("WorldMappingDAO.database_id", use_alter=True),
            nullable=True,
            use_existing_column=True,
        )
    )
    parent_id: Mapped[int] = mapped_column(
        ForeignKey("KinematicStructureEntityDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    child_id: Mapped[int] = mapped_column(
        ForeignKey("KinematicStructureEntityDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    parent_T_connection_expression_id: Mapped[int] = mapped_column(
        ForeignKey("TransformationMatrixMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    connection_T_child_expression_id: Mapped[int] = mapped_column(
        ForeignKey("TransformationMatrixMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    parent: Mapped[KinematicStructureEntityDAO] = relationship(
        "KinematicStructureEntityDAO",
        uselist=False,
        foreign_keys=[parent_id],
        post_update=True,
    )
    child: Mapped[KinematicStructureEntityDAO] = relationship(
        "KinematicStructureEntityDAO",
        uselist=False,
        foreign_keys=[child_id],
        post_update=True,
    )
    parent_T_connection_expression: Mapped[TransformationMatrixMappingDAO] = (
        relationship(
            "TransformationMatrixMappingDAO",
            uselist=False,
            foreign_keys=[parent_T_connection_expression_id],
            post_update=True,
        )
    )
    connection_T_child_expression: Mapped[TransformationMatrixMappingDAO] = (
        relationship(
            "TransformationMatrixMappingDAO",
            uselist=False,
            foreign_keys=[connection_T_child_expression_id],
            post_update=True,
        )
    )

    __mapper_args__ = {
        "polymorphic_identity": "ConnectionDAO",
        "inherit_condition": database_id == WorldEntityDAO.database_id,
    }


class ActiveConnectionDAO(
    ConnectionDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.connections.ActiveConnection
    ],
):

    __tablename__ = "ActiveConnectionDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ConnectionDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    frozen_for_collision_avoidance: Mapped[builtins.bool] = mapped_column(
        use_existing_column=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "ActiveConnectionDAO",
        "inherit_condition": database_id == ConnectionDAO.database_id,
    }


class ActiveConnection1DOFDAO(
    ActiveConnectionDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.connections.ActiveConnection1DOF
    ],
):

    __tablename__ = "ActiveConnection1DOFDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ActiveConnectionDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    multiplier: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    offset: Mapped[builtins.float] = mapped_column(use_existing_column=True)

    axis_id: Mapped[int] = mapped_column(
        ForeignKey("Vector3MappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    dof_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    axis: Mapped[Vector3MappingDAO] = relationship(
        "Vector3MappingDAO", uselist=False, foreign_keys=[axis_id], post_update=True
    )
    dof_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[dof_name_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "ActiveConnection1DOFDAO",
        "inherit_condition": database_id == ActiveConnectionDAO.database_id,
    }


class PrismaticConnectionDAO(
    ActiveConnection1DOFDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.connections.PrismaticConnection
    ],
):

    __tablename__ = "PrismaticConnectionDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ActiveConnection1DOFDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "PrismaticConnectionDAO",
        "inherit_condition": database_id == ActiveConnection1DOFDAO.database_id,
    }


class RevoluteConnectionDAO(
    ActiveConnection1DOFDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.connections.RevoluteConnection
    ],
):

    __tablename__ = "RevoluteConnectionDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ActiveConnection1DOFDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "RevoluteConnectionDAO",
        "inherit_condition": database_id == ActiveConnection1DOFDAO.database_id,
    }


class FixedConnectionDAO(
    ConnectionDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.connections.FixedConnection
    ],
):

    __tablename__ = "FixedConnectionDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ConnectionDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "FixedConnectionDAO",
        "inherit_condition": database_id == ConnectionDAO.database_id,
    }


class PassiveConnectionDAO(
    ConnectionDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.connections.PassiveConnection
    ],
):

    __tablename__ = "PassiveConnectionDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ConnectionDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "PassiveConnectionDAO",
        "inherit_condition": database_id == ConnectionDAO.database_id,
    }


class Connection6DoFDAO(
    PassiveConnectionDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.connections.Connection6DoF
    ],
):

    __tablename__ = "Connection6DoFDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(PassiveConnectionDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    x_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    y_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    z_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    qx_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    qy_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    qz_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    qw_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    x_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[x_name_id], post_update=True
    )
    y_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[y_name_id], post_update=True
    )
    z_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[z_name_id], post_update=True
    )
    qx_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[qx_name_id], post_update=True
    )
    qy_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[qy_name_id], post_update=True
    )
    qz_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[qz_name_id], post_update=True
    )
    qw_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[qw_name_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "Connection6DoFDAO",
        "inherit_condition": database_id == PassiveConnectionDAO.database_id,
    }


class OmniDriveDAO(
    PassiveConnectionDAO,
    DataAccessObject[semantic_digital_twin.world_description.connections.OmniDrive],
):

    __tablename__ = "OmniDriveDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(PassiveConnectionDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    frozen_for_collision_avoidance: Mapped[builtins.bool] = mapped_column(
        use_existing_column=True
    )

    x_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    y_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    roll_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    pitch_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    yaw_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    x_velocity_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    y_velocity_name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    x_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[x_name_id], post_update=True
    )
    y_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[y_name_id], post_update=True
    )
    roll_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[roll_name_id], post_update=True
    )
    pitch_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[pitch_name_id], post_update=True
    )
    yaw_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[yaw_name_id], post_update=True
    )
    x_velocity_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO",
        uselist=False,
        foreign_keys=[x_velocity_name_id],
        post_update=True,
    )
    y_velocity_name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO",
        uselist=False,
        foreign_keys=[y_velocity_name_id],
        post_update=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "OmniDriveDAO",
        "inherit_condition": database_id == PassiveConnectionDAO.database_id,
    }


class DegreeOfFreedomMappingDAO(
    Base, DataAccessObject[semantic_digital_twin.orm.model.DegreeOfFreedomMapping]
):

    __tablename__ = "DegreeOfFreedomMappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    lower_limits: Mapped[typing.List[builtins.float]] = mapped_column(
        JSON, nullable=False, use_existing_column=True
    )
    upper_limits: Mapped[typing.List[builtins.float]] = mapped_column(
        JSON, nullable=False, use_existing_column=True
    )

    worldmappingdao_degrees_of_freedom_id: Mapped[typing.Optional[builtins.int]] = (
        mapped_column(
            ForeignKey("WorldMappingDAO.database_id", use_alter=True),
            nullable=True,
            use_existing_column=True,
        )
    )
    name_id: Mapped[int] = mapped_column(
        ForeignKey("PrefixedNameDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    name: Mapped[PrefixedNameDAO] = relationship(
        "PrefixedNameDAO", uselist=False, foreign_keys=[name_id], post_update=True
    )


class KinematicStructureEntityDAO(
    WorldEntityDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.world_entity.KinematicStructureEntity
    ],
):

    __tablename__ = "KinematicStructureEntityDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(WorldEntityDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    index: Mapped[typing.Optional[builtins.int]] = mapped_column(
        use_existing_column=True
    )

    worldmappingdao_kinematic_structure_entities_id: Mapped[
        typing.Optional[builtins.int]
    ] = mapped_column(
        ForeignKey("WorldMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "KinematicStructureEntityDAO",
        "inherit_condition": database_id == WorldEntityDAO.database_id,
    }


class BodyDAO(
    KinematicStructureEntityDAO,
    DataAccessObject[semantic_digital_twin.world_description.world_entity.Body],
):

    __tablename__ = "BodyDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(KinematicStructureEntityDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    visual_id: Mapped[int] = mapped_column(
        ForeignKey("ShapeCollectionDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    collision_id: Mapped[int] = mapped_column(
        ForeignKey("ShapeCollectionDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    collision_config_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("CollisionCheckingConfigDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    temp_collision_config_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("CollisionCheckingConfigDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    visual: Mapped[ShapeCollectionDAO] = relationship(
        "ShapeCollectionDAO", uselist=False, foreign_keys=[visual_id], post_update=True
    )
    collision: Mapped[ShapeCollectionDAO] = relationship(
        "ShapeCollectionDAO",
        uselist=False,
        foreign_keys=[collision_id],
        post_update=True,
    )
    collision_config: Mapped[CollisionCheckingConfigDAO] = relationship(
        "CollisionCheckingConfigDAO",
        uselist=False,
        foreign_keys=[collision_config_id],
        post_update=True,
    )
    temp_collision_config: Mapped[CollisionCheckingConfigDAO] = relationship(
        "CollisionCheckingConfigDAO",
        uselist=False,
        foreign_keys=[temp_collision_config_id],
        post_update=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "BodyDAO",
        "inherit_condition": database_id == KinematicStructureEntityDAO.database_id,
    }


class RegionDAO(
    KinematicStructureEntityDAO,
    DataAccessObject[semantic_digital_twin.world_description.world_entity.Region],
):

    __tablename__ = "RegionDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(KinematicStructureEntityDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    area_id: Mapped[int] = mapped_column(
        ForeignKey("ShapeCollectionDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    area: Mapped[ShapeCollectionDAO] = relationship(
        "ShapeCollectionDAO", uselist=False, foreign_keys=[area_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "RegionDAO",
        "inherit_condition": database_id == KinematicStructureEntityDAO.database_id,
    }


class SemanticAnnotationDAO(
    WorldEntityDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.world_entity.SemanticAnnotation
    ],
):

    __tablename__ = "SemanticAnnotationDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(WorldEntityDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    worldmappingdao_semantic_annotations_id: Mapped[typing.Optional[builtins.int]] = (
        mapped_column(
            ForeignKey("WorldMappingDAO.database_id", use_alter=True),
            nullable=True,
            use_existing_column=True,
        )
    )

    __mapper_args__ = {
        "polymorphic_identity": "SemanticAnnotationDAO",
        "inherit_condition": database_id == WorldEntityDAO.database_id,
    }


class ComponentsDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Components
    ],
):

    __tablename__ = "ComponentsDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "ComponentsDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class DrawerDAO(
    ComponentsDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Drawer
    ],
):

    __tablename__ = "DrawerDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ComponentsDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    hasdrawersdao_drawers_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("HasDrawersDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    container_id: Mapped[int] = mapped_column(
        ForeignKey("ContainerDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    handle_id: Mapped[int] = mapped_column(
        ForeignKey("HandleDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    cabinetdao_drawers_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("CabinetDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    dresserdao_drawers_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("DresserDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    wardrobedao_drawers_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("WardrobeDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    container: Mapped[ContainerDAO] = relationship(
        "ContainerDAO", uselist=False, foreign_keys=[container_id], post_update=True
    )
    handle: Mapped[HandleDAO] = relationship(
        "HandleDAO", uselist=False, foreign_keys=[handle_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "DrawerDAO",
        "inherit_condition": database_id == ComponentsDAO.database_id,
    }


class EntryWayDAO(
    ComponentsDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.EntryWay
    ],
):

    __tablename__ = "EntryWayDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ComponentsDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    body_id: Mapped[int] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    body: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[body_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "EntryWayDAO",
        "inherit_condition": database_id == ComponentsDAO.database_id,
    }


class DoorDAO(
    EntryWayDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Door
    ],
):

    __tablename__ = "DoorDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(EntryWayDAO.database_id), primary_key=True, use_existing_column=True
    )

    hasdoorsdao_doors_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("HasDoorsDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    handle_id: Mapped[int] = mapped_column(
        ForeignKey("HandleDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    cabinetdao_doors_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("CabinetDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    cupboarddao_doors_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("CupboardDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    dresserdao_doors_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("DresserDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    wardrobedao_doors_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("WardrobeDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    walldao_doors_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("WallDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    handle: Mapped[HandleDAO] = relationship(
        "HandleDAO", uselist=False, foreign_keys=[handle_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "DoorDAO",
        "inherit_condition": database_id == EntryWayDAO.database_id,
    }


class DoubleDoorDAO(
    EntryWayDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.DoubleDoor
    ],
):

    __tablename__ = "DoubleDoorDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(EntryWayDAO.database_id), primary_key=True, use_existing_column=True
    )

    left_door_id: Mapped[int] = mapped_column(
        ForeignKey("DoorDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    right_door_id: Mapped[int] = mapped_column(
        ForeignKey("DoorDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    left_door: Mapped[DoorDAO] = relationship(
        "DoorDAO", uselist=False, foreign_keys=[left_door_id], post_update=True
    )
    right_door: Mapped[DoorDAO] = relationship(
        "DoorDAO", uselist=False, foreign_keys=[right_door_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "DoubleDoorDAO",
        "inherit_condition": database_id == EntryWayDAO.database_id,
    }


class ContainerDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Container
    ],
):

    __tablename__ = "ContainerDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    body_id: Mapped[int] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    body: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[body_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "ContainerDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class FridgeDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Fridge
    ],
):

    __tablename__ = "FridgeDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    body_id: Mapped[int] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    door_id: Mapped[int] = mapped_column(
        ForeignKey("DoorDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    body: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[body_id], post_update=True
    )
    door: Mapped[DoorDAO] = relationship(
        "DoorDAO", uselist=False, foreign_keys=[door_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "FridgeDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class FurnitureDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Furniture
    ],
):

    __tablename__ = "FurnitureDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "FurnitureDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class CabinetDAO(
    FurnitureDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Cabinet
    ],
):

    __tablename__ = "CabinetDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(FurnitureDAO.database_id), primary_key=True, use_existing_column=True
    )

    container_id: Mapped[int] = mapped_column(
        ForeignKey("ContainerDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    container: Mapped[ContainerDAO] = relationship(
        "ContainerDAO", uselist=False, foreign_keys=[container_id], post_update=True
    )
    drawers: Mapped[typing.List[DrawerDAO]] = relationship(
        "DrawerDAO", foreign_keys="[DrawerDAO.cabinetdao_drawers_id]", post_update=True
    )
    doors: Mapped[typing.List[DoorDAO]] = relationship(
        "DoorDAO", foreign_keys="[DoorDAO.cabinetdao_doors_id]", post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "CabinetDAO",
        "inherit_condition": database_id == FurnitureDAO.database_id,
    }


class CupboardDAO(
    FurnitureDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Cupboard
    ],
):

    __tablename__ = "CupboardDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(FurnitureDAO.database_id), primary_key=True, use_existing_column=True
    )

    container_id: Mapped[int] = mapped_column(
        ForeignKey("ContainerDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    container: Mapped[ContainerDAO] = relationship(
        "ContainerDAO", uselist=False, foreign_keys=[container_id], post_update=True
    )
    doors: Mapped[typing.List[DoorDAO]] = relationship(
        "DoorDAO", foreign_keys="[DoorDAO.cupboarddao_doors_id]", post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "CupboardDAO",
        "inherit_condition": database_id == FurnitureDAO.database_id,
    }


class DresserDAO(
    FurnitureDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Dresser
    ],
):

    __tablename__ = "DresserDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(FurnitureDAO.database_id), primary_key=True, use_existing_column=True
    )

    container_id: Mapped[int] = mapped_column(
        ForeignKey("ContainerDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    container: Mapped[ContainerDAO] = relationship(
        "ContainerDAO", uselist=False, foreign_keys=[container_id], post_update=True
    )
    drawers: Mapped[typing.List[DrawerDAO]] = relationship(
        "DrawerDAO", foreign_keys="[DrawerDAO.dresserdao_drawers_id]", post_update=True
    )
    doors: Mapped[typing.List[DoorDAO]] = relationship(
        "DoorDAO", foreign_keys="[DoorDAO.dresserdao_doors_id]", post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "DresserDAO",
        "inherit_condition": database_id == FurnitureDAO.database_id,
    }


class WardrobeDAO(
    FurnitureDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Wardrobe
    ],
):

    __tablename__ = "WardrobeDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(FurnitureDAO.database_id), primary_key=True, use_existing_column=True
    )

    container_id: Mapped[int] = mapped_column(
        ForeignKey("ContainerDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    container: Mapped[ContainerDAO] = relationship(
        "ContainerDAO", uselist=False, foreign_keys=[container_id], post_update=True
    )
    drawers: Mapped[typing.List[DrawerDAO]] = relationship(
        "DrawerDAO", foreign_keys="[DrawerDAO.wardrobedao_drawers_id]", post_update=True
    )
    doors: Mapped[typing.List[DoorDAO]] = relationship(
        "DoorDAO", foreign_keys="[DoorDAO.wardrobedao_doors_id]", post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "WardrobeDAO",
        "inherit_condition": database_id == FurnitureDAO.database_id,
    }


class HandleDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Handle
    ],
):

    __tablename__ = "HandleDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    body_id: Mapped[int] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    body: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[body_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "HandleDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class RoomDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Room
    ],
):

    __tablename__ = "RoomDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    floor_id: Mapped[int] = mapped_column(
        ForeignKey("FloorDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    floor: Mapped[FloorDAO] = relationship(
        "FloorDAO", uselist=False, foreign_keys=[floor_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "RoomDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class RootedSemanticAnnotationDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.world_entity.RootedSemanticAnnotation
    ],
):

    __tablename__ = "RootedSemanticAnnotationDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    root_id: Mapped[int] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    root: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[root_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "RootedSemanticAnnotationDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class AbstractRobotDAO(
    RootedSemanticAnnotationDAO,
    DataAccessObject[semantic_digital_twin.robots.abstract_robot.AbstractRobot],
):

    __tablename__ = "AbstractRobotDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(RootedSemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    torso_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("TorsoDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    default_collision_config_id: Mapped[int] = mapped_column(
        ForeignKey("CollisionCheckingConfigDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    torso: Mapped[TorsoDAO] = relationship(
        "TorsoDAO", uselist=False, foreign_keys=[torso_id], post_update=True
    )
    manipulators: Mapped[typing.List[ManipulatorDAO]] = relationship(
        "ManipulatorDAO",
        foreign_keys="[ManipulatorDAO.abstractrobotdao_manipulators_id]",
        post_update=True,
    )
    sensors: Mapped[typing.List[SensorDAO]] = relationship(
        "SensorDAO",
        foreign_keys="[SensorDAO.abstractrobotdao_sensors_id]",
        post_update=True,
    )
    manipulator_chains: Mapped[typing.List[KinematicChainDAO]] = relationship(
        "KinematicChainDAO",
        foreign_keys="[KinematicChainDAO.abstractrobotdao_manipulator_chains_id]",
        post_update=True,
    )
    sensor_chains: Mapped[typing.List[KinematicChainDAO]] = relationship(
        "KinematicChainDAO",
        foreign_keys="[KinematicChainDAO.abstractrobotdao_sensor_chains_id]",
        post_update=True,
    )
    default_collision_config: Mapped[CollisionCheckingConfigDAO] = relationship(
        "CollisionCheckingConfigDAO",
        uselist=False,
        foreign_keys=[default_collision_config_id],
        post_update=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "AbstractRobotDAO",
        "inherit_condition": database_id == RootedSemanticAnnotationDAO.database_id,
    }


class SemanticEnvironmentAnnotationDAO(
    RootedSemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.world_description.world_entity.SemanticEnvironmentAnnotation
    ],
):

    __tablename__ = "SemanticEnvironmentAnnotationDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(RootedSemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "SemanticEnvironmentAnnotationDAO",
        "inherit_condition": database_id == RootedSemanticAnnotationDAO.database_id,
    }


class SemanticRobotAnnotationDAO(
    RootedSemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.robots.abstract_robot.SemanticRobotAnnotation
    ],
):

    __tablename__ = "SemanticRobotAnnotationDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(RootedSemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "SemanticRobotAnnotationDAO",
        "inherit_condition": database_id == RootedSemanticAnnotationDAO.database_id,
    }


class KinematicChainDAO(
    SemanticRobotAnnotationDAO,
    DataAccessObject[semantic_digital_twin.robots.abstract_robot.KinematicChain],
):

    __tablename__ = "KinematicChainDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticRobotAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    abstractrobotdao_manipulator_chains_id: Mapped[typing.Optional[builtins.int]] = (
        mapped_column(
            ForeignKey("AbstractRobotDAO.database_id", use_alter=True),
            nullable=True,
            use_existing_column=True,
        )
    )
    abstractrobotdao_sensor_chains_id: Mapped[typing.Optional[builtins.int]] = (
        mapped_column(
            ForeignKey("AbstractRobotDAO.database_id", use_alter=True),
            nullable=True,
            use_existing_column=True,
        )
    )
    tip_id: Mapped[int] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    manipulator_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("ManipulatorDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    tip: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[tip_id], post_update=True
    )
    manipulator: Mapped[ManipulatorDAO] = relationship(
        "ManipulatorDAO", uselist=False, foreign_keys=[manipulator_id], post_update=True
    )
    sensors: Mapped[typing.List[SensorDAO]] = relationship(
        "SensorDAO",
        foreign_keys="[SensorDAO.kinematicchaindao_sensors_id]",
        post_update=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "KinematicChainDAO",
        "inherit_condition": database_id == SemanticRobotAnnotationDAO.database_id,
    }


class ArmDAO(
    KinematicChainDAO, DataAccessObject[semantic_digital_twin.robots.abstract_robot.Arm]
):

    __tablename__ = "ArmDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(KinematicChainDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "ArmDAO",
        "inherit_condition": database_id == KinematicChainDAO.database_id,
    }


class FingerDAO(
    KinematicChainDAO,
    DataAccessObject[semantic_digital_twin.robots.abstract_robot.Finger],
):

    __tablename__ = "FingerDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(KinematicChainDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "FingerDAO",
        "inherit_condition": database_id == KinematicChainDAO.database_id,
    }


class NeckDAO(
    KinematicChainDAO,
    DataAccessObject[semantic_digital_twin.robots.abstract_robot.Neck],
):

    __tablename__ = "NeckDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(KinematicChainDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    pitch_body_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    yaw_body_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    pitch_body: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[pitch_body_id], post_update=True
    )
    yaw_body: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[yaw_body_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "NeckDAO",
        "inherit_condition": database_id == KinematicChainDAO.database_id,
    }


class TorsoDAO(
    KinematicChainDAO,
    DataAccessObject[semantic_digital_twin.robots.abstract_robot.Torso],
):

    __tablename__ = "TorsoDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(KinematicChainDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "TorsoDAO",
        "inherit_condition": database_id == KinematicChainDAO.database_id,
    }


class ManipulatorDAO(
    SemanticRobotAnnotationDAO,
    DataAccessObject[semantic_digital_twin.robots.abstract_robot.Manipulator],
):

    __tablename__ = "ManipulatorDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticRobotAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    abstractrobotdao_manipulators_id: Mapped[typing.Optional[builtins.int]] = (
        mapped_column(
            ForeignKey("AbstractRobotDAO.database_id", use_alter=True),
            nullable=True,
            use_existing_column=True,
        )
    )
    tool_frame_id: Mapped[int] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    front_facing_orientation_id: Mapped[int] = mapped_column(
        ForeignKey("QuaternionMappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    front_facing_axis_id: Mapped[int] = mapped_column(
        ForeignKey("Vector3MappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    tool_frame: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[tool_frame_id], post_update=True
    )
    front_facing_orientation: Mapped[QuaternionMappingDAO] = relationship(
        "QuaternionMappingDAO",
        uselist=False,
        foreign_keys=[front_facing_orientation_id],
        post_update=True,
    )
    front_facing_axis: Mapped[Vector3MappingDAO] = relationship(
        "Vector3MappingDAO",
        uselist=False,
        foreign_keys=[front_facing_axis_id],
        post_update=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "ManipulatorDAO",
        "inherit_condition": database_id == SemanticRobotAnnotationDAO.database_id,
    }


class ParallelGripperDAO(
    ManipulatorDAO,
    DataAccessObject[semantic_digital_twin.robots.abstract_robot.ParallelGripper],
):

    __tablename__ = "ParallelGripperDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(ManipulatorDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    finger_id: Mapped[int] = mapped_column(
        ForeignKey("FingerDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    thumb_id: Mapped[int] = mapped_column(
        ForeignKey("FingerDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    finger: Mapped[FingerDAO] = relationship(
        "FingerDAO", uselist=False, foreign_keys=[finger_id], post_update=True
    )
    thumb: Mapped[FingerDAO] = relationship(
        "FingerDAO", uselist=False, foreign_keys=[thumb_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "ParallelGripperDAO",
        "inherit_condition": database_id == ManipulatorDAO.database_id,
    }


class SensorDAO(
    SemanticRobotAnnotationDAO,
    DataAccessObject[semantic_digital_twin.robots.abstract_robot.Sensor],
):

    __tablename__ = "SensorDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticRobotAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    abstractrobotdao_sensors_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("AbstractRobotDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    kinematicchaindao_sensors_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("KinematicChainDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "SensorDAO",
        "inherit_condition": database_id == SemanticRobotAnnotationDAO.database_id,
    }


class CameraDAO(
    SensorDAO, DataAccessObject[semantic_digital_twin.robots.abstract_robot.Camera]
):

    __tablename__ = "CameraDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SensorDAO.database_id), primary_key=True, use_existing_column=True
    )

    minimal_height: Mapped[builtins.float] = mapped_column(use_existing_column=True)
    maximal_height: Mapped[builtins.float] = mapped_column(use_existing_column=True)

    forward_facing_axis_id: Mapped[int] = mapped_column(
        ForeignKey("Vector3MappingDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )
    field_of_view_id: Mapped[int] = mapped_column(
        ForeignKey("FieldOfViewDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    forward_facing_axis: Mapped[Vector3MappingDAO] = relationship(
        "Vector3MappingDAO",
        uselist=False,
        foreign_keys=[forward_facing_axis_id],
        post_update=True,
    )
    field_of_view: Mapped[FieldOfViewDAO] = relationship(
        "FieldOfViewDAO",
        uselist=False,
        foreign_keys=[field_of_view_id],
        post_update=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "CameraDAO",
        "inherit_condition": database_id == SensorDAO.database_id,
    }


class SupportingSurfaceDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.SupportingSurface
    ],
):

    __tablename__ = "SupportingSurfaceDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    region_id: Mapped[int] = mapped_column(
        ForeignKey("RegionDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    region: Mapped[RegionDAO] = relationship(
        "RegionDAO", uselist=False, foreign_keys=[region_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "SupportingSurfaceDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class FloorDAO(
    SupportingSurfaceDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Floor
    ],
):

    __tablename__ = "FloorDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SupportingSurfaceDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    __mapper_args__ = {
        "polymorphic_identity": "FloorDAO",
        "inherit_condition": database_id == SupportingSurfaceDAO.database_id,
    }


class TableDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Table
    ],
):

    __tablename__ = "TableDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    top_id: Mapped[int] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    top: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[top_id], post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "TableDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class WallDAO(
    SemanticAnnotationDAO,
    DataAccessObject[
        semantic_digital_twin.semantic_annotations.semantic_annotations.Wall
    ],
):

    __tablename__ = "WallDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        ForeignKey(SemanticAnnotationDAO.database_id),
        primary_key=True,
        use_existing_column=True,
    )

    body_id: Mapped[int] = mapped_column(
        ForeignKey("BodyDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    body: Mapped[BodyDAO] = relationship(
        "BodyDAO", uselist=False, foreign_keys=[body_id], post_update=True
    )
    doors: Mapped[typing.List[DoorDAO]] = relationship(
        "DoorDAO", foreign_keys="[DoorDAO.walldao_doors_id]", post_update=True
    )

    __mapper_args__ = {
        "polymorphic_identity": "WallDAO",
        "inherit_condition": database_id == SemanticAnnotationDAO.database_id,
    }


class WorldStateMappingDAO(
    Base, DataAccessObject[semantic_digital_twin.orm.model.WorldStateMapping]
):

    __tablename__ = "WorldStateMappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    data: Mapped[typing.List[builtins.float]] = mapped_column(
        JSON, nullable=False, use_existing_column=True
    )

    names: Mapped[typing.List[PrefixedNameDAO]] = relationship(
        "PrefixedNameDAO",
        foreign_keys="[PrefixedNameDAO.worldstatemappingdao_names_id]",
        post_update=True,
    )


class WrappedInstanceMappingDAO(
    Base,
    DataAccessObject[krrood.entity_query_language.orm.model.WrappedInstanceMapping],
):

    __tablename__ = "WrappedInstanceMappingDAO"

    database_id: Mapped[builtins.int] = mapped_column(
        Integer, primary_key=True, use_existing_column=True
    )

    symbolgraphmappingdao_instances_id: Mapped[typing.Optional[builtins.int]] = (
        mapped_column(
            ForeignKey("SymbolGraphMappingDAO.database_id", use_alter=True),
            nullable=True,
            use_existing_column=True,
        )
    )
    instance_id: Mapped[typing.Optional[builtins.int]] = mapped_column(
        ForeignKey("SymbolDAO.database_id", use_alter=True),
        nullable=True,
        use_existing_column=True,
    )

    instance: Mapped[SymbolDAO] = relationship(
        "SymbolDAO", uselist=False, foreign_keys=[instance_id], post_update=True
    )
