use std::collections::BTreeMap;
use std::sync::Arc;
use parking_lot::RwLock;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use fakecloud_core::multi_account::{AccountState, MultiAccountState};
pub const CODEPIPELINE_SNAPSHOT_SCHEMA_VERSION: u32 = 1;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CodePipelineState {
#[serde(default)]
pub pipelines: BTreeMap<String, Value>,
#[serde(default)]
pub pipeline_order: Vec<String>,
#[serde(default)]
pub pipeline_meta: BTreeMap<String, Value>,
#[serde(default)]
pub pipeline_versions: BTreeMap<String, Vec<Value>>,
#[serde(default)]
pub executions: BTreeMap<String, Value>,
#[serde(default)]
pub execution_order: BTreeMap<String, Vec<String>>,
#[serde(default)]
pub transitions_disabled: BTreeMap<String, BTreeMap<String, Value>>,
#[serde(default)]
pub custom_actions: BTreeMap<String, Value>,
#[serde(default)]
pub custom_action_order: Vec<String>,
#[serde(default)]
pub webhooks: BTreeMap<String, Value>,
#[serde(default)]
pub webhook_order: Vec<String>,
#[serde(default)]
pub tags: BTreeMap<String, Vec<Value>>,
}
impl AccountState for CodePipelineState {
fn new_for_account(_account_id: &str, _region: &str, _endpoint: &str) -> Self {
Self::default()
}
}
pub type SharedCodePipelineState = Arc<RwLock<MultiAccountState<CodePipelineState>>>;
#[derive(Debug, Serialize, Deserialize)]
pub struct CodePipelineSnapshot {
pub schema_version: u32,
pub accounts: MultiAccountState<CodePipelineState>,
}