//! Named rendering override bundles under `assets/rendering_profiles/`.

use serde::{Deserialize, Serialize};

use crate::PostProcessVolumeOverrides;

/// RON preset: label plus override bundle applied to volumes or project drafts.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RenderingProfileAsset {
    pub label: String,
    pub overrides: PostProcessVolumeOverrides,
}

impl RenderingProfileAsset {
    pub fn load_from_path(catalog_path: &str) -> Result<Self, String> {
        let text = std::fs::read_to_string(catalog_path)
            .map_err(|err| format!("could not read {catalog_path}: {err}"))?;
        ron::from_str(&text)
            .map_err(|err| format!("invalid rendering profile RON in {catalog_path}: {err}"))
    }
}
