# Entity Relationships

```text
ServiceProvider → type: "immich" (inferred capabilities: notifications, commands)
NotificationTracker → provider_id, collection_ids, scan_interval, adaptive_max_skip, filters, default_tracking_config_id, default_template_config_id, enabled
NotificationTrackerTarget → notification_tracker_id, target_id, tracking_config_id, template_config_id, quiet_hours, enabled
TrackingConfig → provider_type, event flags, scheduling rules
TemplateConfig → provider_type, Jinja2 template slots per event type
NotificationTarget → type: "telegram"/"webhook", config JSON, chat_action (telegram only)
CommandConfig → provider_type, enabled_commands, locale, response_mode, default_count, rate_limits
CommandTracker → provider_id, command_config_id, enabled
CommandTrackerListener → command_tracker_id, listener_type ("telegram_bot"), listener_id
TelegramBot → token, update_mode, bot_username (used as notification target backend + commands listener)
```

- NotificationTrackerTarget links a tracker to a target with per-link tracking/template config and quiet hours
- CommandTrackerListener links a command tracker to a listener (e.g. TelegramBot) for slash-command handling
- `user_id=0` on TemplateConfig = system default (EN/RU seeded on first startup)
- DB: SQLite + async SQLAlchemy via sqlmodel, auto-created on startup with migrations
