Skip to main content

made_core/entities/
deliberation_phase.rs

1use serde::{Deserialize, Serialize};
2
3/// Lifecycle phase of a deliberation aggregate.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5pub enum DeliberationPhase {
6    Proposing,
7    Revising,
8    Validating,
9    Scoring,
10    Completed,
11}
12
13impl DeliberationPhase {
14    pub(super) fn name(self) -> &'static str {
15        match self {
16            Self::Proposing => "Proposing",
17            Self::Revising => "Revising",
18            Self::Validating => "Validating",
19            Self::Scoring => "Scoring",
20            Self::Completed => "Completed",
21        }
22    }
23
24    pub(super) fn next(self) -> Option<Self> {
25        Some(match self {
26            Self::Proposing => Self::Revising,
27            Self::Revising => Self::Validating,
28            Self::Validating => Self::Scoring,
29            Self::Scoring => Self::Completed,
30            Self::Completed => return None,
31        })
32    }
33}