2025-07-11 13:52:19 +00:00

66 lines
2.6 KiB
Python

#!/usr/bin/env python3
"""
ClassroomCopilot Structure Relationships
This module defines the relationships between schools and structure nodes,
as well as between entities and structure nodes.
"""
from typing import ClassVar
from modules.database.tools.neontology.baserelationship import BaseRelationship
import modules.database.schemas.nodes.schools.schools as school_nodes
import modules.database.schemas.nodes.structures.schools as school_structures
import modules.database.schemas.nodes.workers.workers as worker_nodes
class SchoolHasStaffStructure(BaseRelationship):
"""Relationship between a school and its staff structure node."""
__relationshiptype__: ClassVar[str] = 'HAS_STAFF_STRUCTURE'
source: school_nodes.SchoolNode
target: school_structures.StaffStructureNode
class SchoolHasStudentStructure(BaseRelationship):
"""Relationship between a school and its student structure node."""
__relationshiptype__: ClassVar[str] = 'HAS_STUDENT_STRUCTURE'
source: school_nodes.SchoolNode
target: school_structures.StudentStructureNode
class SchoolHasITAdminStructure(BaseRelationship):
"""Relationship between a school and its IT admin structure node."""
__relationshiptype__: ClassVar[str] = 'HAS_IT_ADMIN_STRUCTURE'
source: school_nodes.SchoolNode
target: school_structures.ITAdminStructureNode
class EntityBelongsToStructure(BaseRelationship):
"""
Relationship between an entity (worker, student, etc.) and a structure node.
This is a generic relationship that can be used for any entity type.
"""
__relationshiptype__: ClassVar[str] = 'BELONGS_TO_STRUCTURE'
source: object # Generic source type to allow any entity
target: object # Generic target type to allow any structure
# Specific entity-to-structure relationships
class SuperAdminBelongsToITAdminStructure(BaseRelationship):
"""Relationship between a super admin and the IT admin structure."""
__relationshiptype__: ClassVar[str] = 'BELONGS_TO_STRUCTURE'
source: worker_nodes.SuperAdminNode
target: school_structures.ITAdminStructureNode
class TeacherBelongsToStaffStructure(BaseRelationship):
"""Relationship between a teacher and the staff structure."""
__relationshiptype__: ClassVar[str] = 'BELONGS_TO_STRUCTURE'
source: worker_nodes.TeacherNode
target: school_structures.StaffStructureNode
class StudentBelongsToStudentStructure(BaseRelationship):
"""Relationship between a student and the student structure."""
__relationshiptype__: ClassVar[str] = 'BELONGS_TO_STRUCTURE'
source: worker_nodes.StudentNode
target: school_structures.StudentStructureNode