from typing import ClassVar, Optional
from ..base_nodes import CCBaseNode

class SchoolNode(CCBaseNode):
    __primarylabel__: ClassVar[str] = 'School'
    
    # Core identification fields (required for all databases)
    uuid_string: str  # School's unique identifier within its type
    school_type: str  # e.g., 'development', 'state', 'private', etc.
    name: str
    website: str = 'unknown'
    
    # Public school fields (required for public database)
    statutory_low_age: Optional[int] = None
    statutory_high_age: Optional[int] = None
    phase_of_education: Optional[str] = None
    school_capacity: Optional[int] = None
    religious_character: Optional[str] = None
    ofsted_rating: Optional[str] = None
    
    # Private school fields (required for private database)
    establishment_number: Optional[str] = None
    establishment_name: Optional[str] = None
    establishment_type: Optional[str] = None
    establishment_status: Optional[str] = None
    
    @property
    def database_id(self) -> str:
        """Get the full database identifier for this school"""
        return f"{self.school_type}.{self.id}"
    
    @property
    def public_database_name(self) -> str:
        """Get the public database name for this school"""
        return "cc.institutes"
    
    @property
    def private_database_name(self) -> str:
        """Get the private database name for this school"""
        return f"cc.institutes.{self.database_id}"
    
    @property
    def curriculum_database_name(self) -> str:
        """Get the curriculum database name for this school"""
        return f"{self.private_database_name}.curriculum"

class DepartmentNode(CCBaseNode):
    __primarylabel__: ClassVar[str] = 'Department'
    name: str

class SubjectClassNode(CCBaseNode):
    __primarylabel__: ClassVar[str] = 'SubjectClass'
    name: Optional[str] = 'unknown'
    year_group_id: str
    subject_id: str

class RoomNode(CCBaseNode):
    __primarylabel__: ClassVar[str] = 'Room'
    name: Optional[str] = 'unknown'
    building_id: Optional[str] = 'unknown'
