def test_event_model_has_new_columns():
    from fabledassistant.models.event import Event
    cols = {c.key for c in Event.__table__.columns}
    assert "caldav_uid" in cols
    assert "color" in cols


def test_event_to_dict_includes_new_fields():
    from fabledassistant.models.event import Event
    from datetime import datetime, timezone
    e = Event(
        user_id=1, uid="test-uid", title="Test",
        start_dt=datetime(2026, 3, 25, 10, 0, tzinfo=timezone.utc),
        caldav_uid="sync-uid", color="#6366f1",
    )
    d = e.to_dict()
    assert d["caldav_uid"] == "sync-uid"
    assert d["color"] == "#6366f1"


def test_caldav_create_event_accepts_uid_param():
    """caldav.create_event signature must accept an optional uid param."""
    import inspect
    from fabledassistant.services.caldav import create_event
    sig = inspect.signature(create_event)
    assert "uid" in sig.parameters
