# modules/calendar/models.py
from sqlalchemy import (
    Column,
    Integer,
    String,
    DateTime,
    ForeignKey,
    JSON,
    Boolean,
)
from sqlalchemy.orm import relationship
from core.database import Base


class CalendarEvent(Base):
    __tablename__ = "calendar_events"

    id = Column(Integer, primary_key=True)
    title = Column(String, nullable=False)
    description = Column(String)
    start = Column(DateTime(timezone=True), nullable=False)
    end = Column(DateTime(timezone=True))
    location = Column(String)
    all_day = Column(Boolean, default=False)
    tags = Column(JSON)
    color = Column(String)
    user_id = Column(Integer, ForeignKey("users.id"), nullable=False)

    user = relationship("User", back_populates="calendar_events")
