made_core/entities/
agentic_system_publication_outcome.rs1use crate::value_objects::AgenticSystemDigest;
2
3use super::PublishedAgenticSystem;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
13pub enum AgenticSystemPublicationOutcome {
14 Published(PublishedAgenticSystem),
15 AlreadyPublished(PublishedAgenticSystem),
16 RevisionOccupied {
17 published: AgenticSystemDigest,
18 offered: AgenticSystemDigest,
19 },
20}
21
22impl AgenticSystemPublicationOutcome {
23 #[must_use]
24 pub const fn published(&self) -> Option<&PublishedAgenticSystem> {
25 match self {
26 Self::Published(published) | Self::AlreadyPublished(published) => Some(published),
27 Self::RevisionOccupied { .. } => None,
28 }
29 }
30
31 #[must_use]
32 pub const fn is_conflict(&self) -> bool {
33 matches!(self, Self::RevisionOccupied { .. })
34 }
35
36 #[must_use]
37 pub const fn is_new(&self) -> bool {
38 matches!(self, Self::Published(_))
39 }
40
41 #[must_use]
42 pub const fn as_str(&self) -> &'static str {
43 match self {
44 Self::Published(_) => "published",
45 Self::AlreadyPublished(_) => "already_published",
46 Self::RevisionOccupied { .. } => "revision_occupied",
47 }
48 }
49}