"""Event data access helpers."""

from typing import Optional

from sqlalchemy.orm import Session

from ..models import Event


def get_by_provider_event_id(db: Session, provider_event_id: str) -> Optional[Event]:
    return db.query(Event).filter(Event.provider_event_id == provider_event_id).first()


def create_event(db: Session, event: Event) -> Event:
    db.add(event)
    return event
