Skip to main content

sim_lib_music_serial/
origin.rs

1//! Event role and provenance contracts.
2
3/// Structural role in the serial plan.
4#[derive(Copy, Clone, Debug, PartialEq, Eq)]
5pub enum SerialRole {
6    /// One or more structural row ordinals presented directly.
7    Structural,
8    /// Material derived from prior structural or derived events.
9    Derived,
10    /// Non-structural ornament built around explicit parent material.
11    Ornamental,
12    /// Imported or externally motivated material attached to explicit parents.
13    External,
14}
15
16impl SerialRole {
17    /// Returns the stable role token.
18    pub const fn as_str(self) -> &'static str {
19        match self {
20            Self::Structural => "structural",
21            Self::Derived => "derived",
22            Self::Ornamental => "ornamental",
23            Self::External => "external",
24        }
25    }
26}
27
28/// Additional immutable provenance for one planned event.
29#[derive(Clone, Debug, PartialEq, Eq)]
30pub enum SerialOrigin {
31    /// The event states structural row material directly.
32    Structural {
33        /// Human-facing note about the structural statement.
34        rationale: String,
35    },
36    /// The event derives from explicit parents through a named technique.
37    Derived {
38        /// Stable technique or transform name.
39        technique: String,
40    },
41    /// The event ornaments explicit parents without claiming structural coverage.
42    Ornamental {
43        /// Stable ornament technique name.
44        technique: String,
45    },
46    /// The event imports external material but still cites explicit parent evidence.
47    External {
48        /// Stable external source or rationale tag.
49        source: String,
50    },
51}