from datetime import datetime
from typing import TYPE_CHECKING, Dict, List, Optional

from pydantic import root_validator
from sqlalchemy import Column
from sqlmodel import Field, Relationship, SQLModel

from .event_attendance import EventAttendance
from .types import TimeStamp

if TYPE_CHECKING:
    from .feedback import Feedback, FeedbackList
    from .participant import Participant, ParticipantList


class EventBase(SQLModel):
    name: str

    code: str

    valid_from: datetime = Field(
        sa_column=Column(
            TimeStamp(timezone=True),
            default=datetime.now,
            nullable=False,
        )
    )
    valid_until: datetime = Field(
        sa_column=Column(
            TimeStamp(timezone=True),
            default=datetime.now,
            nullable=False,
        )
    )

    enabled: bool = 