use serde::{Deserialize, Serialize};
use schemars::JsonSchema;
use crate::metadata::frontmatter::{DependencyEntry, ReferenceEntry, ScratchWorkType};
#[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)]
pub struct IdentityUpdate {
pub name: Option<String>,
pub title: Option<String>,
pub description: Option<String>,
pub version: Option<String>,
pub tags: Option<Vec<String>>,
}
#[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)]
pub struct SpecificationUpdate {
#[serde(flatten)]
pub identity: IdentityUpdate,
pub requires_implementation: Option<bool>,
pub dependencies: Option<Vec<DependencyEntry>>,
}
#[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)]
pub struct ImplementationUpdate {
#[serde(flatten)]
pub identity: IdentityUpdate,
pub spec: Option<String>,
pub location: Option<String>,
pub references: Option<Vec<ReferenceEntry>>,
pub dependencies: Option<Vec<DependencyEntry>>,
}
#[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)]
pub struct ScratchUpdate {
#[serde(flatten)]
pub identity: IdentityUpdate,
pub branch: Option<String>,
pub work_type: Option<ScratchWorkType>,
pub dependencies: Option<Vec<DependencyEntry>>,
}
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)]
#[serde(tag = "kind")]
pub enum FrontMatterUpdate {
Specification(SpecificationUpdate),
Implementation(ImplementationUpdate),
Scratch(ScratchUpdate),
}