use std::collections::HashMap; use async_trait::async_trait; use chrono::{DateTime, Utc}; use crate::errors::DomainResult; use crate::models::{GeneratedSchedule, PlaybackRecord}; use crate::value_objects::{BlockId, ChannelId, MediaItemId, ScheduleId}; #[async_trait] pub trait ScheduleCommand: Send + Sync { async fn save(&self, schedule: &GeneratedSchedule) -> DomainResult<()>; async fn save_playback_record(&self, record: &PlaybackRecord) -> DomainResult<()>; async fn delete_schedules_after( &self, channel_id: ChannelId, target_generation: u32, ) -> DomainResult<()>; } #[async_trait] pub trait ScheduleQuery: Send + Sync { async fn find_active( &self, channel_id: ChannelId, at: DateTime, ) -> DomainResult>; async fn find_latest( &self, channel_id: ChannelId, ) -> DomainResult>; async fn find_playback_history( &self, channel_id: ChannelId, ) -> DomainResult>; async fn find_last_slot_per_block( &self, channel_id: ChannelId, ) -> DomainResult>; async fn list_schedule_history( &self, channel_id: ChannelId, ) -> DomainResult>; async fn get_schedule_by_id( &self, channel_id: ChannelId, schedule_id: ScheduleId, ) -> DomainResult>; }