use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use sqlx::types::Json;
use sqlx::FromRow;
#[derive(Debug, Clone, Serialize, FromRow)]
pub struct SnapshotSchedule {
pub id: String,
pub camera_id: String,
pub interval_seconds: i64,
pub enabled: bool,
pub last_fired_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
#[derive(Debug, Deserialize)]
pub struct SnapshotScheduleCreate {
pub interval_seconds: Option<i64>,
pub enabled: Option<bool>,
}
#[derive(Debug, Deserialize, Default)]
pub struct SnapshotScheduleUpdate {
pub interval_seconds: Option<i64>,
pub enabled: Option<bool>,
}
#[derive(Debug, Clone, Serialize, FromRow)]
pub struct PersistedSnapshot {
pub id: String,
pub camera_id: String,
pub schedule_id: Option<String>,
pub path: String,
pub taken_at: DateTime<Utc>,
pub size_bytes: i64,
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, FromRow)]
pub struct RecordSchedule {
pub id: String,
pub camera_id: String,
pub days: Json<Value>,
pub time_start: String,
pub time_end: String,
pub enabled: bool,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
#[derive(Debug, Deserialize)]
pub struct RecordScheduleCreate {
pub days: Value,
pub time_start: String,
pub time_end: String,
pub enabled: Option<bool>,
}
#[derive(Debug, Deserialize, Default)]
pub struct RecordScheduleUpdate {
pub days: Option<Value>,
pub time_start: Option<String>,
pub time_end: Option<String>,
pub enabled: Option<bool>,
}