# 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
from typing_extensions import Optional, List, Type

import semantic_world.connections
import semantic_world.degree_of_freedom
import semantic_world.geometry
import semantic_world.orm.model
import semantic_world.prefixed_name
import semantic_world.spatial_types.spatial_types
import semantic_world.views.views
import semantic_world.world
import semantic_world.world_entity


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

class Base(DeclarativeBase):
    type_mappings = {
        Type: TypeType,
    }


class QuaternionMappingDAO(Base, DataAccessObject[semantic_world.orm.model.QuaternionMapping]):
    __tablename__ = 'QuaternionMappingDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)

    x: Mapped[float]
    y: Mapped[float]
    z: Mapped[float]
    w: Mapped[float]


    reference_frame_id: Mapped[Optional[int]] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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


class ShapeDAO(Base, DataAccessObject[semantic_world.geometry.Shape]):
    __tablename__ = 'ShapeDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)


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

    origin_id: Mapped[int] = mapped_column(ForeignKey('TransformationMatrixMappingDAO.id', use_alter=True), nullable=True)
    bodydao_visual_id: Mapped[Optional[int]] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)
    bodydao_collision_id: Mapped[Optional[int]] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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

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

class Point3MappingDAO(Base, DataAccessObject[semantic_world.orm.model.Point3Mapping]):
    __tablename__ = 'Point3MappingDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)

    x: Mapped[float]
    y: Mapped[float]
    z: Mapped[float]


    reference_frame_id: Mapped[Optional[int]] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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


class ScaleDAO(Base, DataAccessObject[semantic_world.geometry.Scale]):
    __tablename__ = 'ScaleDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)

    x: Mapped[float]
    y: Mapped[float]
    z: Mapped[float]





class BoundingBoxCollectionDAO(Base, DataAccessObject[semantic_world.geometry.BoundingBoxCollection]):
    __tablename__ = 'BoundingBoxCollectionDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)




    bounding_boxes: Mapped[List[BoundingBoxDAO]] = relationship('BoundingBoxDAO', foreign_keys='[BoundingBoxDAO.boundingboxcollectiondao_bounding_boxes_id]', post_update=True)


class WorldEntityDAO(Base, DataAccessObject[semantic_world.world_entity.WorldEntity]):
    __tablename__ = 'WorldEntityDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)


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

    name_id: Mapped[int] = mapped_column(ForeignKey('PrefixedNameDAO.id', use_alter=True), nullable=True)

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

    __mapper_args__ = {
        'polymorphic_on': 'polymorphic_type',
        'polymorphic_identity': 'WorldEntityDAO',
    }

class WorldMappingDAO(Base, DataAccessObject[semantic_world.orm.model.WorldMapping]):
    __tablename__ = 'WorldMappingDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)




    bodies: Mapped[List[BodyDAO]] = relationship('BodyDAO', foreign_keys='[BodyDAO.worldmappingdao_bodies_id]', post_update=True)
    connections: Mapped[List[ConnectionDAO]] = relationship('ConnectionDAO', foreign_keys='[ConnectionDAO.worldmappingdao_connections_id]', post_update=True)
    views: Mapped[List[ViewDAO]] = relationship('ViewDAO', foreign_keys='[ViewDAO.worldmappingdao_views_id]', post_update=True)
    degrees_of_freedom: Mapped[List[DegreeOfFreedomMappingDAO]] = relationship('DegreeOfFreedomMappingDAO', foreign_keys='[DegreeOfFreedomMappingDAO.worldmappingdao_degrees_of_freedom_id]', post_update=True)


class ColorDAO(Base, DataAccessObject[semantic_world.geometry.Color]):
    __tablename__ = 'ColorDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)

    R: Mapped[float]
    G: Mapped[float]
    B: Mapped[float]
    A: Mapped[float]





class Vector3MappingDAO(Base, DataAccessObject[semantic_world.orm.model.Vector3Mapping]):
    __tablename__ = 'Vector3MappingDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)

    x: Mapped[float]
    y: Mapped[float]
    z: Mapped[float]


    reference_frame_id: Mapped[Optional[int]] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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


class BoundingBoxDAO(Base, DataAccessObject[semantic_world.geometry.BoundingBox]):
    __tablename__ = 'BoundingBoxDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)

    min_x: Mapped[float]
    min_y: Mapped[float]
    min_z: Mapped[float]
    max_x: Mapped[float]
    max_y: Mapped[float]
    max_z: Mapped[float]


    boundingboxcollectiondao_bounding_boxes_id: Mapped[Optional[int]] = mapped_column(ForeignKey('BoundingBoxCollectionDAO.id', use_alter=True), nullable=True)



class TransformationMatrixMappingDAO(Base, DataAccessObject[semantic_world.orm.model.TransformationMatrixMapping]):
    __tablename__ = 'TransformationMatrixMappingDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)



    position_id: Mapped[int] = mapped_column(ForeignKey('Point3MappingDAO.id', use_alter=True), nullable=True)
    rotation_id: Mapped[int] = mapped_column(ForeignKey('QuaternionMappingDAO.id', use_alter=True), nullable=True)
    reference_frame_id: Mapped[Optional[int]] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)
    child_frame_id: Mapped[Optional[int]] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=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[BodyDAO] = relationship('BodyDAO', uselist=False, foreign_keys=[reference_frame_id], post_update=True)
    child_frame: Mapped[BodyDAO] = relationship('BodyDAO', uselist=False, foreign_keys=[child_frame_id], post_update=True)


class PrefixedNameDAO(Base, DataAccessObject[semantic_world.prefixed_name.PrefixedName]):
    __tablename__ = 'PrefixedNameDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)


    name: Mapped[str] = mapped_column(String(255), nullable=False)
    prefix: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)




class RotationMatrixMappingDAO(Base, DataAccessObject[semantic_world.orm.model.RotationMatrixMapping]):
    __tablename__ = 'RotationMatrixMappingDAO'

    id: Mapped[int] = mapped_column(Integer, primary_key=True)



    rotation_id: Mapped[int] = mapped_column(ForeignKey('QuaternionMappingDAO.id', use_alter=True), nullable=True)
    reference_frame_id: Mapped[Optional[int]] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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


class PrimitiveDAO(ShapeDAO, DataAccessObject[semantic_world.geometry.Primitive]):
    __tablename__ = 'PrimitiveDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ShapeDAO.id), primary_key=True)



    color_id: Mapped[int] = mapped_column(ForeignKey('ColorDAO.id', use_alter=True), nullable=True)

    color: Mapped[ColorDAO] = relationship('ColorDAO', uselist=False, foreign_keys=[color_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'PrimitiveDAO',
        'inherit_condition': id == ShapeDAO.id,
    }

class MeshDAO(ShapeDAO, DataAccessObject[semantic_world.geometry.Mesh]):
    __tablename__ = 'MeshDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ShapeDAO.id), primary_key=True)


    filename: Mapped[str] = mapped_column(String(255), nullable=False)

    scale_id: Mapped[int] = mapped_column(ForeignKey('ScaleDAO.id', use_alter=True), nullable=True)

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

    __mapper_args__ = {
        'polymorphic_identity': 'MeshDAO',
        'inherit_condition': id == ShapeDAO.id,
    }

class BodyDAO(WorldEntityDAO, DataAccessObject[semantic_world.world_entity.Body]):
    __tablename__ = 'BodyDAO'

    id: Mapped[int] = mapped_column(ForeignKey(WorldEntityDAO.id), primary_key=True)

    index: Mapped[Optional[int]]


    worldmappingdao_bodies_id: Mapped[Optional[int]] = mapped_column(ForeignKey('WorldMappingDAO.id', use_alter=True), nullable=True)

    visual: Mapped[List[ShapeDAO]] = relationship('ShapeDAO', foreign_keys='[ShapeDAO.bodydao_visual_id]', post_update=True)
    collision: Mapped[List[ShapeDAO]] = relationship('ShapeDAO', foreign_keys='[ShapeDAO.bodydao_collision_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'BodyDAO',
        'inherit_condition': id == WorldEntityDAO.id,
    }

class DegreeOfFreedomMappingDAO(WorldEntityDAO, DataAccessObject[semantic_world.orm.model.DegreeOfFreedomMapping]):
    __tablename__ = 'DegreeOfFreedomMappingDAO'

    id: Mapped[int] = mapped_column(ForeignKey(WorldEntityDAO.id), primary_key=True)


    lower_limits: Mapped[List[float]] = mapped_column(JSON, nullable=False)
    upper_limits: Mapped[List[float]] = mapped_column(JSON, nullable=False)

    worldmappingdao_degrees_of_freedom_id: Mapped[Optional[int]] = mapped_column(ForeignKey('WorldMappingDAO.id', use_alter=True), nullable=True)
    name_id: Mapped[int] = mapped_column(ForeignKey('PrefixedNameDAO.id', use_alter=True), nullable=True)

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

    __mapper_args__ = {
        'polymorphic_identity': 'DegreeOfFreedomMappingDAO',
        'inherit_condition': id == WorldEntityDAO.id,
    }

class ConnectionDAO(WorldEntityDAO, DataAccessObject[semantic_world.world_entity.Connection]):
    __tablename__ = 'ConnectionDAO'

    id: Mapped[int] = mapped_column(ForeignKey(WorldEntityDAO.id), primary_key=True)



    worldmappingdao_connections_id: Mapped[Optional[int]] = mapped_column(ForeignKey('WorldMappingDAO.id', use_alter=True), nullable=True)
    parent_id: Mapped[int] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)
    child_id: Mapped[int] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)
    origin_expression_id: Mapped[int] = mapped_column(ForeignKey('TransformationMatrixMappingDAO.id', use_alter=True), nullable=True)

    parent: Mapped[BodyDAO] = relationship('BodyDAO', uselist=False, foreign_keys=[parent_id], post_update=True)
    child: Mapped[BodyDAO] = relationship('BodyDAO', uselist=False, foreign_keys=[child_id], post_update=True)
    origin_expression: Mapped[TransformationMatrixMappingDAO] = relationship('TransformationMatrixMappingDAO', uselist=False, foreign_keys=[origin_expression_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'ConnectionDAO',
        'inherit_condition': id == WorldEntityDAO.id,
    }

class ViewDAO(WorldEntityDAO, DataAccessObject[semantic_world.world_entity.View]):
    __tablename__ = 'ViewDAO'

    id: Mapped[int] = mapped_column(ForeignKey(WorldEntityDAO.id), primary_key=True)



    worldmappingdao_views_id: Mapped[Optional[int]] = mapped_column(ForeignKey('WorldMappingDAO.id', use_alter=True), nullable=True)


    __mapper_args__ = {
        'polymorphic_identity': 'ViewDAO',
        'inherit_condition': id == WorldEntityDAO.id,
    }

class BoxDAO(PrimitiveDAO, DataAccessObject[semantic_world.geometry.Box]):
    __tablename__ = 'BoxDAO'

    id: Mapped[int] = mapped_column(ForeignKey(PrimitiveDAO.id), primary_key=True)



    scale_id: Mapped[int] = mapped_column(ForeignKey('ScaleDAO.id', use_alter=True), nullable=True)

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

    __mapper_args__ = {
        'polymorphic_identity': 'BoxDAO',
        'inherit_condition': id == PrimitiveDAO.id,
    }

class SphereDAO(PrimitiveDAO, DataAccessObject[semantic_world.geometry.Sphere]):
    __tablename__ = 'SphereDAO'

    id: Mapped[int] = mapped_column(ForeignKey(PrimitiveDAO.id), primary_key=True)

    radius: Mapped[float]




    __mapper_args__ = {
        'polymorphic_identity': 'SphereDAO',
        'inherit_condition': id == PrimitiveDAO.id,
    }

class CylinderDAO(PrimitiveDAO, DataAccessObject[semantic_world.geometry.Cylinder]):
    __tablename__ = 'CylinderDAO'

    id: Mapped[int] = mapped_column(ForeignKey(PrimitiveDAO.id), primary_key=True)

    width: Mapped[float]
    height: Mapped[float]




    __mapper_args__ = {
        'polymorphic_identity': 'CylinderDAO',
        'inherit_condition': id == PrimitiveDAO.id,
    }

class ActiveConnectionDAO(ConnectionDAO, DataAccessObject[semantic_world.connections.ActiveConnection]):
    __tablename__ = 'ActiveConnectionDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ConnectionDAO.id), primary_key=True)





    __mapper_args__ = {
        'polymorphic_identity': 'ActiveConnectionDAO',
        'inherit_condition': id == ConnectionDAO.id,
    }

class FixedConnectionDAO(ConnectionDAO, DataAccessObject[semantic_world.connections.FixedConnection]):
    __tablename__ = 'FixedConnectionDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ConnectionDAO.id), primary_key=True)





    __mapper_args__ = {
        'polymorphic_identity': 'FixedConnectionDAO',
        'inherit_condition': id == ConnectionDAO.id,
    }

class PassiveConnectionDAO(ConnectionDAO, DataAccessObject[semantic_world.connections.PassiveConnection]):
    __tablename__ = 'PassiveConnectionDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ConnectionDAO.id), primary_key=True)





    __mapper_args__ = {
        'polymorphic_identity': 'PassiveConnectionDAO',
        'inherit_condition': id == ConnectionDAO.id,
    }

class RootedViewDAO(ViewDAO, DataAccessObject[semantic_world.world_entity.RootedView]):
    __tablename__ = 'RootedViewDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ViewDAO.id), primary_key=True)



    root_id: Mapped[int] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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

    __mapper_args__ = {
        'polymorphic_identity': 'RootedViewDAO',
        'inherit_condition': id == ViewDAO.id,
    }

class FridgeDAO(ViewDAO, DataAccessObject[semantic_world.views.views.Fridge]):
    __tablename__ = 'FridgeDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ViewDAO.id), primary_key=True)



    body_id: Mapped[int] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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

    __mapper_args__ = {
        'polymorphic_identity': 'FridgeDAO',
        'inherit_condition': id == ViewDAO.id,
    }

class TableDAO(ViewDAO, DataAccessObject[semantic_world.views.views.Table]):
    __tablename__ = 'TableDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ViewDAO.id), primary_key=True)



    top_id: Mapped[int] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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

    __mapper_args__ = {
        'polymorphic_identity': 'TableDAO',
        'inherit_condition': id == ViewDAO.id,
    }

class HandleDAO(ViewDAO, DataAccessObject[semantic_world.views.views.Handle]):
    __tablename__ = 'HandleDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ViewDAO.id), primary_key=True)



    body_id: Mapped[int] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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

    __mapper_args__ = {
        'polymorphic_identity': 'HandleDAO',
        'inherit_condition': id == ViewDAO.id,
    }

class ComponentsDAO(ViewDAO, DataAccessObject[semantic_world.views.views.Components]):
    __tablename__ = 'ComponentsDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ViewDAO.id), primary_key=True)





    __mapper_args__ = {
        'polymorphic_identity': 'ComponentsDAO',
        'inherit_condition': id == ViewDAO.id,
    }

class FurnitureDAO(ViewDAO, DataAccessObject[semantic_world.views.views.Furniture]):
    __tablename__ = 'FurnitureDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ViewDAO.id), primary_key=True)





    __mapper_args__ = {
        'polymorphic_identity': 'FurnitureDAO',
        'inherit_condition': id == ViewDAO.id,
    }

class ContainerDAO(ViewDAO, DataAccessObject[semantic_world.views.views.Container]):
    __tablename__ = 'ContainerDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ViewDAO.id), primary_key=True)



    body_id: Mapped[int] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)

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

    __mapper_args__ = {
        'polymorphic_identity': 'ContainerDAO',
        'inherit_condition': id == ViewDAO.id,
    }

class PrismaticConnectionDAO(ActiveConnectionDAO, DataAccessObject[semantic_world.connections.PrismaticConnection]):
    __tablename__ = 'PrismaticConnectionDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ActiveConnectionDAO.id), primary_key=True)

    multiplier: Mapped[float]
    offset: Mapped[float]


    axis_id: Mapped[int] = mapped_column(ForeignKey('Vector3MappingDAO.id', use_alter=True), nullable=True)
    dof_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)

    axis: Mapped[Vector3MappingDAO] = relationship('Vector3MappingDAO', uselist=False, foreign_keys=[axis_id], post_update=True)
    dof: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[dof_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'PrismaticConnectionDAO',
        'inherit_condition': id == ActiveConnectionDAO.id,
    }

class OmniDriveDAO(ActiveConnectionDAO, DataAccessObject[semantic_world.connections.OmniDrive]):
    __tablename__ = 'OmniDriveDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ActiveConnectionDAO.id), primary_key=True)

    translation_velocity_limits: Mapped[float]
    rotation_velocity_limits: Mapped[float]


    x_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    y_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    z_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    roll_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    pitch_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    yaw_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    x_vel_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    y_vel_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)

    x: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[x_id], post_update=True)
    y: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[y_id], post_update=True)
    z: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[z_id], post_update=True)
    roll: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[roll_id], post_update=True)
    pitch: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[pitch_id], post_update=True)
    yaw: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[yaw_id], post_update=True)
    x_vel: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[x_vel_id], post_update=True)
    y_vel: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[y_vel_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'OmniDriveDAO',
        'inherit_condition': id == ActiveConnectionDAO.id,
    }

class RevoluteConnectionDAO(ActiveConnectionDAO, DataAccessObject[semantic_world.connections.RevoluteConnection]):
    __tablename__ = 'RevoluteConnectionDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ActiveConnectionDAO.id), primary_key=True)

    multiplier: Mapped[float]
    offset: Mapped[float]


    axis_id: Mapped[int] = mapped_column(ForeignKey('Vector3MappingDAO.id', use_alter=True), nullable=True)
    dof_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)

    axis: Mapped[Vector3MappingDAO] = relationship('Vector3MappingDAO', uselist=False, foreign_keys=[axis_id], post_update=True)
    dof: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[dof_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'RevoluteConnectionDAO',
        'inherit_condition': id == ActiveConnectionDAO.id,
    }

class Connection6DoFDAO(PassiveConnectionDAO, DataAccessObject[semantic_world.connections.Connection6DoF]):
    __tablename__ = 'Connection6DoFDAO'

    id: Mapped[int] = mapped_column(ForeignKey(PassiveConnectionDAO.id), primary_key=True)



    x_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    y_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    z_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    qx_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    qy_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    qz_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)
    qw_id: Mapped[int] = mapped_column(ForeignKey('DegreeOfFreedomMappingDAO.id', use_alter=True), nullable=True)

    x: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[x_id], post_update=True)
    y: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[y_id], post_update=True)
    z: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[z_id], post_update=True)
    qx: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[qx_id], post_update=True)
    qy: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[qy_id], post_update=True)
    qz: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[qz_id], post_update=True)
    qw: Mapped[DegreeOfFreedomMappingDAO] = relationship('DegreeOfFreedomMappingDAO', uselist=False, foreign_keys=[qw_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'Connection6DoFDAO',
        'inherit_condition': id == PassiveConnectionDAO.id,
    }

class EnvironmentViewDAO(RootedViewDAO, DataAccessObject[semantic_world.world_entity.EnvironmentView]):
    __tablename__ = 'EnvironmentViewDAO'

    id: Mapped[int] = mapped_column(ForeignKey(RootedViewDAO.id), primary_key=True)





    __mapper_args__ = {
        'polymorphic_identity': 'EnvironmentViewDAO',
        'inherit_condition': id == RootedViewDAO.id,
    }

class DrawerDAO(ComponentsDAO, DataAccessObject[semantic_world.views.views.Drawer]):
    __tablename__ = 'DrawerDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ComponentsDAO.id), primary_key=True)



    container_id: Mapped[int] = mapped_column(ForeignKey('ContainerDAO.id', use_alter=True), nullable=True)
    handle_id: Mapped[int] = mapped_column(ForeignKey('HandleDAO.id', use_alter=True), nullable=True)
    cabinetdao_drawers_id: Mapped[Optional[int]] = mapped_column(ForeignKey('CabinetDAO.id', use_alter=True), nullable=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': id == ComponentsDAO.id,
    }

class DoorDAO(ComponentsDAO, DataAccessObject[semantic_world.views.views.Door]):
    __tablename__ = 'DoorDAO'

    id: Mapped[int] = mapped_column(ForeignKey(ComponentsDAO.id), primary_key=True)



    body_id: Mapped[int] = mapped_column(ForeignKey('BodyDAO.id', use_alter=True), nullable=True)
    handle_id: Mapped[int] = mapped_column(ForeignKey('HandleDAO.id', use_alter=True), nullable=True)
    wardrobedao_doors_id: Mapped[Optional[int]] = mapped_column(ForeignKey('WardrobeDAO.id', use_alter=True), nullable=True)

    body: Mapped[BodyDAO] = relationship('BodyDAO', uselist=False, foreign_keys=[body_id], post_update=True)
    handle: Mapped[HandleDAO] = relationship('HandleDAO', uselist=False, foreign_keys=[handle_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'DoorDAO',
        'inherit_condition': id == ComponentsDAO.id,
    }

class CupboardDAO(FurnitureDAO, DataAccessObject[semantic_world.views.views.Cupboard]):
    __tablename__ = 'CupboardDAO'

    id: Mapped[int] = mapped_column(ForeignKey(FurnitureDAO.id), primary_key=True)





    __mapper_args__ = {
        'polymorphic_identity': 'CupboardDAO',
        'inherit_condition': id == FurnitureDAO.id,
    }

class WardrobeDAO(CupboardDAO, DataAccessObject[semantic_world.views.views.Wardrobe]):
    __tablename__ = 'WardrobeDAO'

    id: Mapped[int] = mapped_column(ForeignKey(CupboardDAO.id), primary_key=True)




    doors: Mapped[List[DoorDAO]] = relationship('DoorDAO', foreign_keys='[DoorDAO.wardrobedao_doors_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'WardrobeDAO',
        'inherit_condition': id == CupboardDAO.id,
    }

class CabinetDAO(CupboardDAO, DataAccessObject[semantic_world.views.views.Cabinet]):
    __tablename__ = 'CabinetDAO'

    id: Mapped[int] = mapped_column(ForeignKey(CupboardDAO.id), primary_key=True)



    container_id: Mapped[int] = mapped_column(ForeignKey('ContainerDAO.id', use_alter=True), nullable=True)

    container: Mapped[ContainerDAO] = relationship('ContainerDAO', uselist=False, foreign_keys=[container_id], post_update=True)
    drawers: Mapped[List[DrawerDAO]] = relationship('DrawerDAO', foreign_keys='[DrawerDAO.cabinetdao_drawers_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'CabinetDAO',
        'inherit_condition': id == CupboardDAO.id,
    }

