made_core/value_objects/council_selector.rs
1//! [`CouncilSelector`] — how the caller of `RunCouncilDecision`
2//! identifies the council that owns the deliberation.
3//!
4//! Mirrors the proto-side `oneof selector`: either a stable
5//! [`CouncilId`] (preferred when the caller already knows it) or the
6//! [`Specialty`] the council is registered under (preferred when the
7//! caller's view of the world is domain-shaped — "ask the triage
8//! council", not "ask council 0x42").
9
10use crate::value_objects::{CouncilId, Specialty};
11
12#[derive(Debug, Clone, Eq, PartialEq)]
13pub enum CouncilSelector {
14 ById(CouncilId),
15 BySpecialty(Specialty),
16}
17
18impl CouncilSelector {
19 /// Convenience constructor for the by-specialty arm.
20 #[must_use]
21 pub fn by_specialty(specialty: Specialty) -> Self {
22 Self::BySpecialty(specialty)
23 }
24
25 /// Convenience constructor for the by-id arm.
26 #[must_use]
27 pub fn by_id(council_id: CouncilId) -> Self {
28 Self::ById(council_id)
29 }
30}