# 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 krrood.generator
import krrood.lubm
from krrood.lubm import ResearchArea

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

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


class PublicationDAO(Base, DataAccessObject[krrood.lubm.Publication]):
    __tablename__ = 'PublicationDAO'

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


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

    publication_research_id: Mapped[Optional[int]] = mapped_column(ForeignKey('ResearchDAO.id', use_alter=True), nullable=True)
    organizationdao_publications_id: Mapped[Optional[int]] = mapped_column(ForeignKey('OrganizationDAO.id', use_alter=True), nullable=True)
    datasetdao_publications_id: Mapped[Optional[int]] = mapped_column(ForeignKey('DatasetDAO.id', use_alter=True), nullable=True)
    softwaredao_software_documentation_id: Mapped[Optional[int]] = mapped_column(ForeignKey('SoftwareDAO.id', use_alter=True), nullable=True)

    authors: Mapped[List[PersonDAO]] = relationship('PersonDAO', foreign_keys='[PersonDAO.publicationdao_authors_id]', post_update=True)
    publication_research: Mapped[ResearchDAO] = relationship('ResearchDAO', uselist=False, foreign_keys=[publication_research_id], post_update=True)

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

class PersonDAO(Base, DataAccessObject[krrood.lubm.Person]):
    __tablename__ = 'PersonDAO'

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

    age: Mapped[Optional[int]]

    name: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
    email_address: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
    telephone: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
    title: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
    polymorphic_type: Mapped[str] = mapped_column(String(255), nullable=False)

    publicationdao_authors_id: Mapped[Optional[int]] = mapped_column(ForeignKey('PublicationDAO.id', use_alter=True), nullable=True)
    advisor_id: Mapped[Optional[int]] = mapped_column(ForeignKey('ProfessorDAO.id', use_alter=True), nullable=True)
    organizationdao_members_id: Mapped[Optional[int]] = mapped_column(ForeignKey('OrganizationDAO.id', use_alter=True), nullable=True)
    organizationdao_affiliates_id: Mapped[Optional[int]] = mapped_column(ForeignKey('OrganizationDAO.id', use_alter=True), nullable=True)
    datasetdao_persons_id: Mapped[Optional[int]] = mapped_column(ForeignKey('DatasetDAO.id', use_alter=True), nullable=True)
    universitydao_alumni_id: Mapped[Optional[int]] = mapped_column(ForeignKey('UniversityDAO.id', use_alter=True), nullable=True)

    advisor: Mapped[ProfessorDAO] = relationship('ProfessorDAO', uselist=False, foreign_keys=[advisor_id], post_update=True)
    degree_from: Mapped[List[UniversityDAO]] = relationship('UniversityDAO', foreign_keys='[UniversityDAO.persondao_degree_from_id]', post_update=True)
    undergraduate_degree_from: Mapped[List[UniversityDAO]] = relationship('UniversityDAO', foreign_keys='[UniversityDAO.persondao_undergraduate_degree_from_id]', post_update=True)
    masters_degree_from: Mapped[List[UniversityDAO]] = relationship('UniversityDAO', foreign_keys='[UniversityDAO.persondao_masters_degree_from_id]', post_update=True)
    doctoral_degree_from: Mapped[List[UniversityDAO]] = relationship('UniversityDAO', foreign_keys='[UniversityDAO.persondao_doctoral_degree_from_id]', post_update=True)
    member_of: Mapped[List[OrganizationDAO]] = relationship('OrganizationDAO', foreign_keys='[OrganizationDAO.persondao_member_of_id]', post_update=True)
    affiliate_of: Mapped[List[OrganizationDAO]] = relationship('OrganizationDAO', foreign_keys='[OrganizationDAO.persondao_affiliate_of_id]', post_update=True)

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

class OrganizationDAO(Base, DataAccessObject[krrood.lubm.Organization]):
    __tablename__ = 'OrganizationDAO'

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


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

    persondao_member_of_id: Mapped[Optional[int]] = mapped_column(ForeignKey('PersonDAO.id', use_alter=True), nullable=True)
    persondao_affiliate_of_id: Mapped[Optional[int]] = mapped_column(ForeignKey('PersonDAO.id', use_alter=True), nullable=True)
    sub_organization_of_id: Mapped[Optional[int]] = mapped_column(ForeignKey('OrganizationDAO.id', use_alter=True), nullable=True)
    organizationdao_affiliated_organization_of_id: Mapped[Optional[int]] = mapped_column(ForeignKey('OrganizationDAO.id', use_alter=True), nullable=True)
    datasetdao_organizations_id: Mapped[Optional[int]] = mapped_column(ForeignKey('DatasetDAO.id', use_alter=True), nullable=True)

    sub_organization_of: Mapped[OrganizationDAO] = relationship('OrganizationDAO', uselist=False, foreign_keys=[sub_organization_of_id], post_update=True)
    affiliated_organization_of: Mapped[List[OrganizationDAO]] = relationship('OrganizationDAO', foreign_keys='[OrganizationDAO.organizationdao_affiliated_organization_of_id]', post_update=True)
    members: Mapped[List[PersonDAO]] = relationship('PersonDAO', foreign_keys='[PersonDAO.organizationdao_members_id]', post_update=True)
    affiliates: Mapped[List[PersonDAO]] = relationship('PersonDAO', foreign_keys='[PersonDAO.organizationdao_affiliates_id]', post_update=True)
    publications: Mapped[List[PublicationDAO]] = relationship('PublicationDAO', foreign_keys='[PublicationDAO.organizationdao_publications_id]', post_update=True)

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

class WorkDAO(Base, DataAccessObject[krrood.lubm.Work]):
    __tablename__ = 'WorkDAO'

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


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

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


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

class DatasetDAO(Base, DataAccessObject[krrood.generator.Dataset]):
    __tablename__ = 'DatasetDAO'

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




    organizations: Mapped[List[OrganizationDAO]] = relationship('OrganizationDAO', foreign_keys='[OrganizationDAO.datasetdao_organizations_id]', post_update=True)
    publications: Mapped[List[PublicationDAO]] = relationship('PublicationDAO', foreign_keys='[PublicationDAO.datasetdao_publications_id]', post_update=True)
    works: Mapped[List[WorkDAO]] = relationship('WorkDAO', foreign_keys='[WorkDAO.datasetdao_works_id]', post_update=True)
    schedules: Mapped[List[ScheduleDAO]] = relationship('ScheduleDAO', foreign_keys='[ScheduleDAO.datasetdao_schedules_id]', post_update=True)
    persons: Mapped[List[PersonDAO]] = relationship('PersonDAO', foreign_keys='[PersonDAO.datasetdao_persons_id]', post_update=True)


class ScheduleDAO(Base, DataAccessObject[krrood.lubm.Schedule]):
    __tablename__ = 'ScheduleDAO'

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



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

    listed_courses: Mapped[List[CourseDAO]] = relationship('CourseDAO', foreign_keys='[CourseDAO.scheduledao_listed_courses_id]', post_update=True)


class BookDAO(PublicationDAO, DataAccessObject[krrood.lubm.Book]):
    __tablename__ = 'BookDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'BookDAO',
        'inherit_condition': id == PublicationDAO.id,
    }

class SpecificationDAO(PublicationDAO, DataAccessObject[krrood.lubm.Specification]):
    __tablename__ = 'SpecificationDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'SpecificationDAO',
        'inherit_condition': id == PublicationDAO.id,
    }

class UnofficialPublicationDAO(PublicationDAO, DataAccessObject[krrood.lubm.UnofficialPublication]):
    __tablename__ = 'UnofficialPublicationDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'UnofficialPublicationDAO',
        'inherit_condition': id == PublicationDAO.id,
    }

class ManualDAO(PublicationDAO, DataAccessObject[krrood.lubm.Manual]):
    __tablename__ = 'ManualDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'ManualDAO',
        'inherit_condition': id == PublicationDAO.id,
    }

class SoftwareDAO(PublicationDAO, DataAccessObject[krrood.lubm.Software]):
    __tablename__ = 'SoftwareDAO'

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


    software_version: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)


    software_documentation: Mapped[List[PublicationDAO]] = relationship('PublicationDAO', foreign_keys='[PublicationDAO.softwaredao_software_documentation_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'SoftwareDAO',
        'inherit_condition': id == PublicationDAO.id,
    }

class ArticleDAO(PublicationDAO, DataAccessObject[krrood.lubm.Article]):
    __tablename__ = 'ArticleDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'ArticleDAO',
        'inherit_condition': id == PublicationDAO.id,
    }

class StudentDAO(PersonDAO, DataAccessObject[krrood.lubm.Student]):
    __tablename__ = 'StudentDAO'

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




    takes_courses: Mapped[List[CourseDAO]] = relationship('CourseDAO', foreign_keys='[CourseDAO.studentdao_takes_courses_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'StudentDAO',
        'inherit_condition': id == PersonDAO.id,
    }

class ResearchAssistantDAO(PersonDAO, DataAccessObject[krrood.lubm.ResearchAssistant]):
    __tablename__ = 'ResearchAssistantDAO'

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



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

    works_for: Mapped[ResearchGroupDAO] = relationship('ResearchGroupDAO', uselist=False, foreign_keys=[works_for_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'ResearchAssistantDAO',
        'inherit_condition': id == PersonDAO.id,
    }

class EmployeeDAO(PersonDAO, DataAccessObject[krrood.lubm.Employee]):
    __tablename__ = 'EmployeeDAO'

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



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

    works_for: Mapped[OrganizationDAO] = relationship('OrganizationDAO', uselist=False, foreign_keys=[works_for_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'EmployeeDAO',
        'inherit_condition': id == PersonDAO.id,
    }

class DirectorDAO(PersonDAO, DataAccessObject[krrood.lubm.Director]):
    __tablename__ = 'DirectorDAO'

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



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

    head_of: Mapped[ProgramDAO] = relationship('ProgramDAO', uselist=False, foreign_keys=[head_of_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'DirectorDAO',
        'inherit_condition': id == PersonDAO.id,
    }

class GraduateStudentDAO(PersonDAO, DataAccessObject[krrood.lubm.GraduateStudent]):
    __tablename__ = 'GraduateStudentDAO'

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




    takes_courses: Mapped[List[GraduateCourseDAO]] = relationship('GraduateCourseDAO', foreign_keys='[GraduateCourseDAO.graduatestudentdao_takes_courses_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'GraduateStudentDAO',
        'inherit_condition': id == PersonDAO.id,
    }

class TeachingAssistantDAO(PersonDAO, DataAccessObject[krrood.lubm.TeachingAssistant]):
    __tablename__ = 'TeachingAssistantDAO'

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



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

    teaching_assistant_of: Mapped[List[CourseDAO]] = relationship('CourseDAO', foreign_keys='[CourseDAO.teachingassistantdao_teaching_assistant_of_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'TeachingAssistantDAO',
        'inherit_condition': id == PersonDAO.id,
    }

class UniversityDAO(OrganizationDAO, DataAccessObject[krrood.lubm.University]):
    __tablename__ = 'UniversityDAO'

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



    persondao_degree_from_id: Mapped[Optional[int]] = mapped_column(ForeignKey('PersonDAO.id', use_alter=True), nullable=True)
    persondao_undergraduate_degree_from_id: Mapped[Optional[int]] = mapped_column(ForeignKey('PersonDAO.id', use_alter=True), nullable=True)
    persondao_masters_degree_from_id: Mapped[Optional[int]] = mapped_column(ForeignKey('PersonDAO.id', use_alter=True), nullable=True)
    persondao_doctoral_degree_from_id: Mapped[Optional[int]] = mapped_column(ForeignKey('PersonDAO.id', use_alter=True), nullable=True)

    alumni: Mapped[List[PersonDAO]] = relationship('PersonDAO', foreign_keys='[PersonDAO.universitydao_alumni_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'UniversityDAO',
        'inherit_condition': id == OrganizationDAO.id,
    }

class CollegeDAO(OrganizationDAO, DataAccessObject[krrood.lubm.College]):
    __tablename__ = 'CollegeDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'CollegeDAO',
        'inherit_condition': id == OrganizationDAO.id,
    }

class InstituteDAO(OrganizationDAO, DataAccessObject[krrood.lubm.Institute]):
    __tablename__ = 'InstituteDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'InstituteDAO',
        'inherit_condition': id == OrganizationDAO.id,
    }

class ResearchGroupDAO(OrganizationDAO, DataAccessObject[krrood.lubm.ResearchGroup]):
    __tablename__ = 'ResearchGroupDAO'

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




    research_projects: Mapped[List[ResearchDAO]] = relationship('ResearchDAO', foreign_keys='[ResearchDAO.researchgroupdao_research_projects_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'ResearchGroupDAO',
        'inherit_condition': id == OrganizationDAO.id,
    }

class DepartmentDAO(OrganizationDAO, DataAccessObject[krrood.lubm.Department]):
    __tablename__ = 'DepartmentDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'DepartmentDAO',
        'inherit_condition': id == OrganizationDAO.id,
    }

class ProgramDAO(OrganizationDAO, DataAccessObject[krrood.lubm.Program]):
    __tablename__ = 'ProgramDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'ProgramDAO',
        'inherit_condition': id == OrganizationDAO.id,
    }

class CourseDAO(WorkDAO, DataAccessObject[krrood.lubm.Course]):
    __tablename__ = 'CourseDAO'

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



    scheduledao_listed_courses_id: Mapped[Optional[int]] = mapped_column(ForeignKey('ScheduleDAO.id', use_alter=True), nullable=True)
    studentdao_takes_courses_id: Mapped[Optional[int]] = mapped_column(ForeignKey('StudentDAO.id', use_alter=True), nullable=True)
    teachingassistantdao_teaching_assistant_of_id: Mapped[Optional[int]] = mapped_column(ForeignKey('TeachingAssistantDAO.id', use_alter=True), nullable=True)
    teacher_id: Mapped[Optional[int]] = mapped_column(ForeignKey('FacultyDAO.id', use_alter=True), nullable=True)
    facultydao_teaches_id: Mapped[Optional[int]] = mapped_column(ForeignKey('FacultyDAO.id', use_alter=True), nullable=True)

    teacher: Mapped[FacultyDAO] = relationship('FacultyDAO', uselist=False, foreign_keys=[teacher_id], post_update=True)
    teaching_assistants: Mapped[List[TeachingAssistantDAO]] = relationship('TeachingAssistantDAO', foreign_keys='[TeachingAssistantDAO.coursedao_teaching_assistants_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'CourseDAO',
        'inherit_condition': id == WorkDAO.id,
    }

class ResearchDAO(WorkDAO, DataAccessObject[krrood.lubm.Research]):
    __tablename__ = 'ResearchDAO'

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



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


    __mapper_args__ = {
        'polymorphic_identity': 'ResearchDAO',
        'inherit_condition': id == WorkDAO.id,
    }

class ConferencePaperDAO(ArticleDAO, DataAccessObject[krrood.lubm.ConferencePaper]):
    __tablename__ = 'ConferencePaperDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'ConferencePaperDAO',
        'inherit_condition': id == ArticleDAO.id,
    }

class JournalArticleDAO(ArticleDAO, DataAccessObject[krrood.lubm.JournalArticle]):
    __tablename__ = 'JournalArticleDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'JournalArticleDAO',
        'inherit_condition': id == ArticleDAO.id,
    }

class TechnicalReportDAO(ArticleDAO, DataAccessObject[krrood.lubm.TechnicalReport]):
    __tablename__ = 'TechnicalReportDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'TechnicalReportDAO',
        'inherit_condition': id == ArticleDAO.id,
    }

class UndergraduateStudentDAO(StudentDAO, DataAccessObject[krrood.lubm.UndergraduateStudent]):
    __tablename__ = 'UndergraduateStudentDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'UndergraduateStudentDAO',
        'inherit_condition': id == StudentDAO.id,
    }

class FacultyDAO(EmployeeDAO, DataAccessObject[krrood.lubm.Faculty]):
    __tablename__ = 'FacultyDAO'

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

    research_interest: Mapped[Optional[krrood.lubm.ResearchArea]]

    office_number: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)


    teaches: Mapped[List[CourseDAO]] = relationship('CourseDAO', foreign_keys='[CourseDAO.facultydao_teaches_id]', post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'FacultyDAO',
        'inherit_condition': id == EmployeeDAO.id,
    }

class AdministrativeStaffDAO(EmployeeDAO, DataAccessObject[krrood.lubm.AdministrativeStaff]):
    __tablename__ = 'AdministrativeStaffDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'AdministrativeStaffDAO',
        'inherit_condition': id == EmployeeDAO.id,
    }

class GraduateCourseDAO(CourseDAO, DataAccessObject[krrood.lubm.GraduateCourse]):
    __tablename__ = 'GraduateCourseDAO'

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



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


    __mapper_args__ = {
        'polymorphic_identity': 'GraduateCourseDAO',
        'inherit_condition': id == CourseDAO.id,
    }

class ProfessorDAO(FacultyDAO, DataAccessObject[krrood.lubm.Professor]):
    __tablename__ = 'ProfessorDAO'

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

    tenured: Mapped[Optional[bool]]




    __mapper_args__ = {
        'polymorphic_identity': 'ProfessorDAO',
        'inherit_condition': id == FacultyDAO.id,
    }

class PostDocDAO(FacultyDAO, DataAccessObject[krrood.lubm.PostDoc]):
    __tablename__ = 'PostDocDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'PostDocDAO',
        'inherit_condition': id == FacultyDAO.id,
    }

class LecturerDAO(FacultyDAO, DataAccessObject[krrood.lubm.Lecturer]):
    __tablename__ = 'LecturerDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'LecturerDAO',
        'inherit_condition': id == FacultyDAO.id,
    }

class ClericalStaffDAO(AdministrativeStaffDAO, DataAccessObject[krrood.lubm.ClericalStaff]):
    __tablename__ = 'ClericalStaffDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'ClericalStaffDAO',
        'inherit_condition': id == AdministrativeStaffDAO.id,
    }

class SystemsStaffDAO(AdministrativeStaffDAO, DataAccessObject[krrood.lubm.SystemsStaff]):
    __tablename__ = 'SystemsStaffDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'SystemsStaffDAO',
        'inherit_condition': id == AdministrativeStaffDAO.id,
    }

class FullProfessorDAO(ProfessorDAO, DataAccessObject[krrood.lubm.FullProfessor]):
    __tablename__ = 'FullProfessorDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'FullProfessorDAO',
        'inherit_condition': id == ProfessorDAO.id,
    }

class DeanDAO(ProfessorDAO, DataAccessObject[krrood.lubm.Dean]):
    __tablename__ = 'DeanDAO'

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



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

    head_of: Mapped[CollegeDAO] = relationship('CollegeDAO', uselist=False, foreign_keys=[head_of_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'DeanDAO',
        'inherit_condition': id == ProfessorDAO.id,
    }

class AssociateProfessorDAO(ProfessorDAO, DataAccessObject[krrood.lubm.AssociateProfessor]):
    __tablename__ = 'AssociateProfessorDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'AssociateProfessorDAO',
        'inherit_condition': id == ProfessorDAO.id,
    }

class VisitingProfessorDAO(ProfessorDAO, DataAccessObject[krrood.lubm.VisitingProfessor]):
    __tablename__ = 'VisitingProfessorDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'VisitingProfessorDAO',
        'inherit_condition': id == ProfessorDAO.id,
    }

class AssistantProfessorDAO(ProfessorDAO, DataAccessObject[krrood.lubm.AssistantProfessor]):
    __tablename__ = 'AssistantProfessorDAO'

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





    __mapper_args__ = {
        'polymorphic_identity': 'AssistantProfessorDAO',
        'inherit_condition': id == ProfessorDAO.id,
    }

class ChairDAO(ProfessorDAO, DataAccessObject[krrood.lubm.Chair]):
    __tablename__ = 'ChairDAO'

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



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

    head_of: Mapped[DepartmentDAO] = relationship('DepartmentDAO', uselist=False, foreign_keys=[head_of_id], post_update=True)

    __mapper_args__ = {
        'polymorphic_identity': 'ChairDAO',
        'inherit_condition': id == ProfessorDAO.id,
    }

