use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct WallpaperState {
    pub image_count: usize,
    pub enabled: bool,
    pub interval_minutes: usize,
    pub shuffle: bool,
    pub lock_screen_only: bool,
    pub current_index: usize,
    pub image_urls: Vec<String>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SettingRequest {
    pub name: String,
    pub value: bool,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IntervalRequest {
    pub minutes: usize,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GalleryRequest {
    pub offset: usize,
    pub limit: usize,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DeleteImageRequest {
    pub id: String,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DeleteImagesRequest {
    pub ids: Vec<String>,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImageIdsResponse {
    pub ids: Vec<String>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImageCropRequest {
    pub id: String,
    pub mode: String,
    pub zoom: f64,
    pub position_x: f64,
    pub position_y: f64,
    pub rotation: i32,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GalleryImage {
    pub id: String,
    pub url: String,
    pub selected: bool,
    pub crop_mode: String,
    pub crop_zoom: f64,
    pub crop_position_x: f64,
    pub crop_position_y: f64,
    pub crop_rotation: i32,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GalleryPage {
    pub total: usize,
    pub items: Vec<GalleryImage>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImmichConnectRequest {
    pub server_url: String,
    pub api_key: String,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImmichConnection {
    pub configured: bool,
    pub server_url: String,
    pub user_name: String,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImmichAlbum {
    pub id: String,
    pub name: String,
    pub asset_count: usize,
    pub thumbnail_url: String,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImmichAlbumsResponse {
    pub albums: Vec<ImmichAlbum>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImmichAssetsRequest {
    pub album_id: Option<String>,
    pub page: usize,
    pub size: usize,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImmichAsset {
    pub id: String,
    pub file_name: String,
    pub thumbnail_url: String,
    pub taken_at: String,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImmichAssetsPage {
    pub items: Vec<ImmichAsset>,
    pub page: usize,
    pub has_more: bool,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImmichImportRequest {
    pub ids: Vec<String>,
}

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ImmichImportProgress {
    pub active: bool,
    pub completed: usize,
    pub total: usize,
    pub bytes_downloaded: u64,
    pub bytes_total: u64,
}
