// @generated — Generated by `cargo xtask machine-codegen --all`.
#![allow(
    clippy::unwrap_used,
    clippy::expect_used,
    clippy::panic,
    clippy::implicit_clone,
    clippy::unnecessary_cast,
    clippy::redundant_clone,
    clippy::zero_sized_map_values
)]

pub fn schema() -> meerkat_machine_schema::MachineSchema {
    meerkat_machine_schema::catalog::dsl::dsl_work_graph_lifecycle_machine()
}

#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkCloseStatusAdmissionKind {
    #[default]
    #[serde(rename = "DeniedNonTerminal")]
    DeniedNonTerminal,
    #[serde(rename = "AdmittedCompleted")]
    AdmittedCompleted,
    #[serde(rename = "AdmittedCancelled")]
    AdmittedCancelled,
    #[serde(rename = "AdmittedFailed")]
    AdmittedFailed,
}
impl WorkCloseStatusAdmissionKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::DeniedNonTerminal => "DeniedNonTerminal",
            Self::AdmittedCompleted => "AdmittedCompleted",
            Self::AdmittedCancelled => "AdmittedCancelled",
            Self::AdmittedFailed => "AdmittedFailed",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkCloseStatusAdmissionKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "DeniedNonTerminal" => Ok(Self::DeniedNonTerminal),
            "AdmittedCompleted" => Ok(Self::AdmittedCompleted),
            "AdmittedCancelled" => Ok(Self::AdmittedCancelled),
            "AdmittedFailed" => Ok(Self::AdmittedFailed),
            other => Err(format!(
                "invalid WorkCloseStatusAdmissionKind value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for WorkCloseStatusAdmissionKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkCloseStatusAdmissionKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkCompletionPolicy {
    #[default]
    #[serde(rename = "SelfAttest")]
    SelfAttest,
    #[serde(rename = "HostConfirmed")]
    HostConfirmed,
    #[serde(rename = "PrincipalConfirmed")]
    PrincipalConfirmed,
    #[serde(rename = "Supervisor")]
    Supervisor,
    #[serde(rename = "ReviewerQuorum")]
    ReviewerQuorum,
}
impl WorkCompletionPolicy {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::SelfAttest => "SelfAttest",
            Self::HostConfirmed => "HostConfirmed",
            Self::PrincipalConfirmed => "PrincipalConfirmed",
            Self::Supervisor => "Supervisor",
            Self::ReviewerQuorum => "ReviewerQuorum",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkCompletionPolicy {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "SelfAttest" => Ok(Self::SelfAttest),
            "HostConfirmed" => Ok(Self::HostConfirmed),
            "PrincipalConfirmed" => Ok(Self::PrincipalConfirmed),
            "Supervisor" => Ok(Self::Supervisor),
            "ReviewerQuorum" => Ok(Self::ReviewerQuorum),
            other => Err(format!("invalid WorkCompletionPolicy value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for WorkCompletionPolicy {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkCompletionPolicy {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkCompletionPolicyMutationAdmissionKind {
    #[default]
    #[serde(rename = "Denied")]
    Denied,
    #[serde(rename = "Admitted")]
    Admitted,
}
impl WorkCompletionPolicyMutationAdmissionKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Denied => "Denied",
            Self::Admitted => "Admitted",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkCompletionPolicyMutationAdmissionKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Denied" => Ok(Self::Denied),
            "Admitted" => Ok(Self::Admitted),
            other => Err(format!(
                "invalid WorkCompletionPolicyMutationAdmissionKind value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for WorkCompletionPolicyMutationAdmissionKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkCompletionPolicyMutationAdmissionKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkConfirmationAdmissionKind {
    #[default]
    #[serde(rename = "DeniedPrincipalRequired")]
    DeniedPrincipalRequired,
    #[serde(rename = "DeniedPrincipalKindMismatch")]
    DeniedPrincipalKindMismatch,
    #[serde(rename = "DeniedSupervisorMismatch")]
    DeniedSupervisorMismatch,
    #[serde(rename = "DeniedEvidenceKind")]
    DeniedEvidenceKind,
    #[serde(rename = "DeniedSelfAttestEmptyEvidenceKind")]
    DeniedSelfAttestEmptyEvidenceKind,
    #[serde(rename = "Admitted")]
    Admitted,
}
impl WorkConfirmationAdmissionKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::DeniedPrincipalRequired => "DeniedPrincipalRequired",
            Self::DeniedPrincipalKindMismatch => "DeniedPrincipalKindMismatch",
            Self::DeniedSupervisorMismatch => "DeniedSupervisorMismatch",
            Self::DeniedEvidenceKind => "DeniedEvidenceKind",
            Self::DeniedSelfAttestEmptyEvidenceKind => "DeniedSelfAttestEmptyEvidenceKind",
            Self::Admitted => "Admitted",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkConfirmationAdmissionKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "DeniedPrincipalRequired" => Ok(Self::DeniedPrincipalRequired),
            "DeniedPrincipalKindMismatch" => Ok(Self::DeniedPrincipalKindMismatch),
            "DeniedSupervisorMismatch" => Ok(Self::DeniedSupervisorMismatch),
            "DeniedEvidenceKind" => Ok(Self::DeniedEvidenceKind),
            "DeniedSelfAttestEmptyEvidenceKind" => Ok(Self::DeniedSelfAttestEmptyEvidenceKind),
            "Admitted" => Ok(Self::Admitted),
            other => Err(format!(
                "invalid WorkConfirmationAdmissionKind value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for WorkConfirmationAdmissionKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkConfirmationAdmissionKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkConfirmationEvidenceObservation {
    #[default]
    #[serde(rename = "Empty")]
    Empty,
    #[serde(rename = "Other")]
    Other,
    #[serde(rename = "HostConfirmation")]
    HostConfirmation,
    #[serde(rename = "PrincipalConfirmation")]
    PrincipalConfirmation,
    #[serde(rename = "SupervisorConfirmation")]
    SupervisorConfirmation,
    #[serde(rename = "ReviewerConfirmation")]
    ReviewerConfirmation,
}
impl WorkConfirmationEvidenceObservation {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Empty => "Empty",
            Self::Other => "Other",
            Self::HostConfirmation => "HostConfirmation",
            Self::PrincipalConfirmation => "PrincipalConfirmation",
            Self::SupervisorConfirmation => "SupervisorConfirmation",
            Self::ReviewerConfirmation => "ReviewerConfirmation",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkConfirmationEvidenceObservation {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Empty" => Ok(Self::Empty),
            "Other" => Ok(Self::Other),
            "HostConfirmation" => Ok(Self::HostConfirmation),
            "PrincipalConfirmation" => Ok(Self::PrincipalConfirmation),
            "SupervisorConfirmation" => Ok(Self::SupervisorConfirmation),
            "ReviewerConfirmation" => Ok(Self::ReviewerConfirmation),
            other => Err(format!(
                "invalid WorkConfirmationEvidenceObservation value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for WorkConfirmationEvidenceObservation {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkConfirmationEvidenceObservation {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkCreateCompletionPolicyAdmissionKind {
    #[default]
    #[serde(rename = "DeniedNonSelfAttest")]
    DeniedNonSelfAttest,
    #[serde(rename = "Admitted")]
    Admitted,
}
impl WorkCreateCompletionPolicyAdmissionKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::DeniedNonSelfAttest => "DeniedNonSelfAttest",
            Self::Admitted => "Admitted",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkCreateCompletionPolicyAdmissionKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "DeniedNonSelfAttest" => Ok(Self::DeniedNonSelfAttest),
            "Admitted" => Ok(Self::Admitted),
            other => Err(format!(
                "invalid WorkCreateCompletionPolicyAdmissionKind value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for WorkCreateCompletionPolicyAdmissionKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkCreateCompletionPolicyAdmissionKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkCreateStatusAdmissionKind {
    #[default]
    #[serde(rename = "Denied")]
    Denied,
    #[serde(rename = "AdmittedOpen")]
    AdmittedOpen,
    #[serde(rename = "AdmittedBlocked")]
    AdmittedBlocked,
}
impl WorkCreateStatusAdmissionKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Denied => "Denied",
            Self::AdmittedOpen => "AdmittedOpen",
            Self::AdmittedBlocked => "AdmittedBlocked",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkCreateStatusAdmissionKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Denied" => Ok(Self::Denied),
            "AdmittedOpen" => Ok(Self::AdmittedOpen),
            "AdmittedBlocked" => Ok(Self::AdmittedBlocked),
            other => Err(format!(
                "invalid WorkCreateStatusAdmissionKind value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for WorkCreateStatusAdmissionKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkCreateStatusAdmissionKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
pub type WorkDependencyPathKey =
    meerkat_machine_schema::catalog::dsl::workgraph_lifecycle::WorkDependencyPathKey;
pub type WorkEdgeKey = meerkat_machine_schema::catalog::dsl::workgraph_lifecycle::WorkEdgeKey;
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkEdgeKind {
    #[default]
    #[serde(rename = "Blocks")]
    Blocks,
    #[serde(rename = "Parent")]
    Parent,
    #[serde(rename = "Related")]
    Related,
    #[serde(rename = "Supersedes")]
    Supersedes,
    #[serde(rename = "DerivedFrom")]
    DerivedFrom,
}
impl WorkEdgeKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Blocks => "Blocks",
            Self::Parent => "Parent",
            Self::Related => "Related",
            Self::Supersedes => "Supersedes",
            Self::DerivedFrom => "DerivedFrom",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkEdgeKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Blocks" => Ok(Self::Blocks),
            "Parent" => Ok(Self::Parent),
            "Related" => Ok(Self::Related),
            "Supersedes" => Ok(Self::Supersedes),
            "DerivedFrom" => Ok(Self::DerivedFrom),
            other => Err(format!("invalid WorkEdgeKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for WorkEdgeKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkEdgeKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkEvidenceKind {
    #[default]
    #[serde(rename = "SelfAttest")]
    SelfAttest,
    #[serde(rename = "HostConfirmation")]
    HostConfirmation,
    #[serde(rename = "PrincipalConfirmation")]
    PrincipalConfirmation,
    #[serde(rename = "SupervisorConfirmation")]
    SupervisorConfirmation,
    #[serde(rename = "ReviewerConfirmation")]
    ReviewerConfirmation,
}
impl WorkEvidenceKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::SelfAttest => "SelfAttest",
            Self::HostConfirmation => "HostConfirmation",
            Self::PrincipalConfirmation => "PrincipalConfirmation",
            Self::SupervisorConfirmation => "SupervisorConfirmation",
            Self::ReviewerConfirmation => "ReviewerConfirmation",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkEvidenceKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "SelfAttest" => Ok(Self::SelfAttest),
            "HostConfirmation" => Ok(Self::HostConfirmation),
            "PrincipalConfirmation" => Ok(Self::PrincipalConfirmation),
            "SupervisorConfirmation" => Ok(Self::SupervisorConfirmation),
            "ReviewerConfirmation" => Ok(Self::ReviewerConfirmation),
            other => Err(format!("invalid WorkEvidenceKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for WorkEvidenceKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkEvidenceKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkGraphErrorKind {
    #[default]
    #[serde(rename = "NotFound")]
    NotFound,
    #[serde(rename = "AttentionNotFound")]
    AttentionNotFound,
    #[serde(rename = "StaleRevision")]
    StaleRevision,
    #[serde(rename = "Conflict")]
    Conflict,
    #[serde(rename = "InvalidTransition")]
    InvalidTransition,
    #[serde(rename = "InvalidInput")]
    InvalidInput,
    #[serde(rename = "InvalidTimestampMillis")]
    InvalidTimestampMillis,
    #[serde(rename = "Store")]
    Store,
    #[serde(rename = "UnsupportedBackend")]
    UnsupportedBackend,
}
impl WorkGraphErrorKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::NotFound => "NotFound",
            Self::AttentionNotFound => "AttentionNotFound",
            Self::StaleRevision => "StaleRevision",
            Self::Conflict => "Conflict",
            Self::InvalidTransition => "InvalidTransition",
            Self::InvalidInput => "InvalidInput",
            Self::InvalidTimestampMillis => "InvalidTimestampMillis",
            Self::Store => "Store",
            Self::UnsupportedBackend => "UnsupportedBackend",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkGraphErrorKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "NotFound" => Ok(Self::NotFound),
            "AttentionNotFound" => Ok(Self::AttentionNotFound),
            "StaleRevision" => Ok(Self::StaleRevision),
            "Conflict" => Ok(Self::Conflict),
            "InvalidTransition" => Ok(Self::InvalidTransition),
            "InvalidInput" => Ok(Self::InvalidInput),
            "InvalidTimestampMillis" => Ok(Self::InvalidTimestampMillis),
            "Store" => Ok(Self::Store),
            "UnsupportedBackend" => Ok(Self::UnsupportedBackend),
            other => Err(format!("invalid WorkGraphErrorKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for WorkGraphErrorKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkGraphErrorKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkGraphPublicErrorClass {
    #[default]
    #[serde(rename = "NotFound")]
    NotFound,
    #[serde(rename = "Conflict")]
    Conflict,
    #[serde(rename = "InvalidTransition")]
    InvalidTransition,
    #[serde(rename = "InvalidArguments")]
    InvalidArguments,
    #[serde(rename = "CapabilityUnavailable")]
    CapabilityUnavailable,
    #[serde(rename = "StoreError")]
    StoreError,
}
impl WorkGraphPublicErrorClass {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::NotFound => "NotFound",
            Self::Conflict => "Conflict",
            Self::InvalidTransition => "InvalidTransition",
            Self::InvalidArguments => "InvalidArguments",
            Self::CapabilityUnavailable => "CapabilityUnavailable",
            Self::StoreError => "StoreError",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkGraphPublicErrorClass {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "NotFound" => Ok(Self::NotFound),
            "Conflict" => Ok(Self::Conflict),
            "InvalidTransition" => Ok(Self::InvalidTransition),
            "InvalidArguments" => Ok(Self::InvalidArguments),
            "CapabilityUnavailable" => Ok(Self::CapabilityUnavailable),
            "StoreError" => Ok(Self::StoreError),
            other => Err(format!("invalid WorkGraphPublicErrorClass value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for WorkGraphPublicErrorClass {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkGraphPublicErrorClass {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct WorkItemKey(pub String);
impl From<String> for WorkItemKey {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for WorkItemKey {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for WorkItemKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkLifecycleState {
    #[default]
    #[serde(rename = "Absent")]
    Absent,
    #[serde(rename = "Open")]
    Open,
    #[serde(rename = "InProgress")]
    InProgress,
    #[serde(rename = "Blocked")]
    Blocked,
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Cancelled")]
    Cancelled,
    #[serde(rename = "Failed")]
    Failed,
}
impl WorkLifecycleState {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Absent => "Absent",
            Self::Open => "Open",
            Self::InProgress => "InProgress",
            Self::Blocked => "Blocked",
            Self::Completed => "Completed",
            Self::Cancelled => "Cancelled",
            Self::Failed => "Failed",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkLifecycleState {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Absent" => Ok(Self::Absent),
            "Open" => Ok(Self::Open),
            "InProgress" => Ok(Self::InProgress),
            "Blocked" => Ok(Self::Blocked),
            "Completed" => Ok(Self::Completed),
            "Cancelled" => Ok(Self::Cancelled),
            "Failed" => Ok(Self::Failed),
            other => Err(format!("invalid WorkLifecycleState value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for WorkLifecycleState {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkLifecycleState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
pub type WorkOwnerKey = meerkat_machine_schema::catalog::dsl::workgraph_lifecycle::WorkOwnerKey;
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkOwnerKind {
    #[default]
    #[serde(rename = "Principal")]
    Principal,
    #[serde(rename = "Agent")]
    Agent,
    #[serde(rename = "Session")]
    Session,
    #[serde(rename = "Mob")]
    Mob,
    #[serde(rename = "Label")]
    Label,
}
impl WorkOwnerKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Principal => "Principal",
            Self::Agent => "Agent",
            Self::Session => "Session",
            Self::Mob => "Mob",
            Self::Label => "Label",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkOwnerKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Principal" => Ok(Self::Principal),
            "Agent" => Ok(Self::Agent),
            "Session" => Ok(Self::Session),
            "Mob" => Ok(Self::Mob),
            "Label" => Ok(Self::Label),
            other => Err(format!("invalid WorkOwnerKind value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for WorkOwnerKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkOwnerKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}
#[allow(non_camel_case_types)]
#[derive(
    Debug,
    Clone,
    Copy,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub enum WorkPublicConfirmationAdmissionKind {
    #[default]
    #[serde(rename = "DeniedRequiresTrustedHost")]
    DeniedRequiresTrustedHost,
    #[serde(rename = "Admitted")]
    Admitted,
}
impl WorkPublicConfirmationAdmissionKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::DeniedRequiresTrustedHost => "DeniedRequiresTrustedHost",
            Self::Admitted => "Admitted",
        }
    }
}
impl std::convert::TryFrom<&str> for WorkPublicConfirmationAdmissionKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "DeniedRequiresTrustedHost" => Ok(Self::DeniedRequiresTrustedHost),
            "Admitted" => Ok(Self::Admitted),
            other => Err(format!(
                "invalid WorkPublicConfirmationAdmissionKind value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for WorkPublicConfirmationAdmissionKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for WorkPublicConfirmationAdmissionKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_str())
    }
}

pub trait Context {}
pub struct EmptyContext;
impl Context for EmptyContext {}

#[allow(non_camel_case_types)]
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Phase {
    Absent,
    Open,
    InProgress,
    Blocked,
    Completed,
    Cancelled,
    Failed,
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct State {
    pub phase: Phase,
    pub revision: u64,
    pub unresolved_blocker_count: u64,
    pub topology_item_keys: std::collections::BTreeSet<WorkItemKey>,
    pub topology_edge_keys: std::collections::BTreeSet<WorkEdgeKey>,
    pub blocks_reachability: std::collections::BTreeSet<WorkDependencyPathKey>,
    pub parent_reachability: std::collections::BTreeSet<WorkDependencyPathKey>,
    pub claim_owner_key: Option<WorkOwnerKey>,
    pub claimed_at_utc_ms: Option<u64>,
    pub lease_expires_at_utc_ms: Option<u64>,
    pub due_at_utc_ms: Option<u64>,
    pub not_before_utc_ms: Option<u64>,
    pub snoozed_until_utc_ms: Option<u64>,
    pub completion_policy: WorkCompletionPolicy,
    pub completion_supervisor_owner_key: Option<WorkOwnerKey>,
    pub completion_reviewer_quorum_threshold: Option<u64>,
    pub terminal_at_utc_ms: Option<u64>,
    pub evidence_count: u64,
    pub host_confirmation_count: u64,
    pub principal_confirmation_count: u64,
    pub supervisor_confirmation_owner_keys: std::collections::BTreeSet<WorkOwnerKey>,
    pub reviewer_confirmation_owner_keys: std::collections::BTreeSet<WorkOwnerKey>,
}
impl Default for State {
    fn default() -> Self {
        initial_state()
    }
}

pub mod inputs {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CreateOpen {
        pub due_at_utc_ms: Option<u64>,
        pub not_before_utc_ms: Option<u64>,
        pub snoozed_until_utc_ms: Option<u64>,
        pub completion_policy: WorkCompletionPolicy,
        pub completion_supervisor_owner_key: Option<WorkOwnerKey>,
        pub completion_reviewer_quorum_threshold: Option<u64>,
        pub unresolved_blocker_count: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CreateBlocked {
        pub due_at_utc_ms: Option<u64>,
        pub not_before_utc_ms: Option<u64>,
        pub snoozed_until_utc_ms: Option<u64>,
        pub completion_policy: WorkCompletionPolicy,
        pub completion_supervisor_owner_key: Option<WorkOwnerKey>,
        pub completion_reviewer_quorum_threshold: Option<u64>,
        pub unresolved_blocker_count: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Update {
        pub expected_revision: u64,
        pub due_at_utc_ms: Option<u64>,
        pub not_before_utc_ms: Option<u64>,
        pub snoozed_until_utc_ms: Option<u64>,
        pub completion_policy: WorkCompletionPolicy,
        pub completion_supervisor_owner_key: Option<WorkOwnerKey>,
        pub completion_reviewer_quorum_threshold: Option<u64>,
        pub unresolved_blocker_count: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Claim {
        pub expected_revision: u64,
        pub owner_key: WorkOwnerKey,
        pub now_utc_ms: u64,
        pub lease_expires_at_utc_ms: Option<u64>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Release {
        pub expected_revision: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Block {
        pub expected_revision: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RefreshEligibility {
        pub unresolved_blocker_count: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ValidateLink {
        pub kind: WorkEdgeKind,
        pub from_item_key: WorkItemKey,
        pub to_item_key: WorkItemKey,
        pub edge_key: WorkEdgeKey,
        pub reverse_path_key: WorkDependencyPathKey,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CloseCompleted {
        pub expected_revision: u64,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CloseCancelled {
        pub expected_revision: u64,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CloseFailed {
        pub expected_revision: u64,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AddEvidence {
        pub expected_revision: u64,
        pub evidence_kind: WorkEvidenceKind,
        pub confirming_owner_key: Option<WorkOwnerKey>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyWorkGraphPublicError {
        pub kind: WorkGraphErrorKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyTerminality {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyBlockerSatisfied {
        pub blocker_present: bool,
        pub blocker_lifecycle_phase: WorkLifecycleState,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyCreateStatusAdmission {
        pub requested_status: WorkLifecycleState,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyCreateCompletionPolicyAdmission {
        pub completion_policy: WorkCompletionPolicy,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyCloseStatusAdmission {
        pub requested_status: WorkLifecycleState,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyPublicConfirmationAdmission {
        pub completion_policy: WorkCompletionPolicy,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyCompletionPolicyMutationAdmission {
        pub requested_completion_policy: WorkCompletionPolicy,
        pub requested_completion_supervisor_owner_key: Option<WorkOwnerKey>,
        pub requested_completion_reviewer_quorum_threshold: Option<u64>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyConfirmationAdmission {
        pub completion_policy: WorkCompletionPolicy,
        pub completion_supervisor_owner_key: Option<WorkOwnerKey>,
        pub requested_principal_owner_key: Option<WorkOwnerKey>,
        pub requested_principal_kind: Option<WorkOwnerKind>,
        pub supplied_evidence_kind: WorkConfirmationEvidenceObservation,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyReadiness {
        pub now_utc_ms: u64,
    }
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Input {
    CreateOpen(inputs::CreateOpen),
    CreateBlocked(inputs::CreateBlocked),
    Update(inputs::Update),
    Claim(inputs::Claim),
    Release(inputs::Release),
    Block(inputs::Block),
    RefreshEligibility(inputs::RefreshEligibility),
    ValidateLink(inputs::ValidateLink),
    CloseCompleted(inputs::CloseCompleted),
    CloseCancelled(inputs::CloseCancelled),
    CloseFailed(inputs::CloseFailed),
    AddEvidence(inputs::AddEvidence),
    ClassifyWorkGraphPublicError(inputs::ClassifyWorkGraphPublicError),
    ClassifyTerminality(inputs::ClassifyTerminality),
    ClassifyBlockerSatisfied(inputs::ClassifyBlockerSatisfied),
    ClassifyCreateStatusAdmission(inputs::ClassifyCreateStatusAdmission),
    ClassifyCreateCompletionPolicyAdmission(inputs::ClassifyCreateCompletionPolicyAdmission),
    ClassifyCloseStatusAdmission(inputs::ClassifyCloseStatusAdmission),
    ClassifyPublicConfirmationAdmission(inputs::ClassifyPublicConfirmationAdmission),
    ClassifyCompletionPolicyMutationAdmission(inputs::ClassifyCompletionPolicyMutationAdmission),
    ClassifyConfirmationAdmission(inputs::ClassifyConfirmationAdmission),
    ClassifyReadiness(inputs::ClassifyReadiness),
}
impl Input {
    pub fn kind(&self) -> InputKind {
        match self {
            Self::CreateOpen(_) => InputKind::CreateOpen,
            Self::CreateBlocked(_) => InputKind::CreateBlocked,
            Self::Update(_) => InputKind::Update,
            Self::Claim(_) => InputKind::Claim,
            Self::Release(_) => InputKind::Release,
            Self::Block(_) => InputKind::Block,
            Self::RefreshEligibility(_) => InputKind::RefreshEligibility,
            Self::ValidateLink(_) => InputKind::ValidateLink,
            Self::CloseCompleted(_) => InputKind::CloseCompleted,
            Self::CloseCancelled(_) => InputKind::CloseCancelled,
            Self::CloseFailed(_) => InputKind::CloseFailed,
            Self::AddEvidence(_) => InputKind::AddEvidence,
            Self::ClassifyWorkGraphPublicError(_) => InputKind::ClassifyWorkGraphPublicError,
            Self::ClassifyTerminality(_) => InputKind::ClassifyTerminality,
            Self::ClassifyBlockerSatisfied(_) => InputKind::ClassifyBlockerSatisfied,
            Self::ClassifyCreateStatusAdmission(_) => InputKind::ClassifyCreateStatusAdmission,
            Self::ClassifyCreateCompletionPolicyAdmission(_) => {
                InputKind::ClassifyCreateCompletionPolicyAdmission
            }
            Self::ClassifyCloseStatusAdmission(_) => InputKind::ClassifyCloseStatusAdmission,
            Self::ClassifyPublicConfirmationAdmission(_) => {
                InputKind::ClassifyPublicConfirmationAdmission
            }
            Self::ClassifyCompletionPolicyMutationAdmission(_) => {
                InputKind::ClassifyCompletionPolicyMutationAdmission
            }
            Self::ClassifyConfirmationAdmission(_) => InputKind::ClassifyConfirmationAdmission,
            Self::ClassifyReadiness(_) => InputKind::ClassifyReadiness,
        }
    }
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum InputKind {
    CreateOpen,
    CreateBlocked,
    Update,
    Claim,
    Release,
    Block,
    RefreshEligibility,
    ValidateLink,
    CloseCompleted,
    CloseCancelled,
    CloseFailed,
    AddEvidence,
    ClassifyWorkGraphPublicError,
    ClassifyTerminality,
    ClassifyBlockerSatisfied,
    ClassifyCreateStatusAdmission,
    ClassifyCreateCompletionPolicyAdmission,
    ClassifyCloseStatusAdmission,
    ClassifyPublicConfirmationAdmission,
    ClassifyCompletionPolicyMutationAdmission,
    ClassifyConfirmationAdmission,
    ClassifyReadiness,
}

pub mod effects {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Created {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Updated {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Claimed {
        pub owner_key: WorkOwnerKey,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Released {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Blocked {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct LinkValidated {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Closed {
        pub terminal_state: WorkLifecycleState,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct EvidenceAdded {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct WorkGraphPublicErrorClassified {
        pub kind: WorkGraphErrorKind,
        pub public_class: WorkGraphPublicErrorClass,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct WorkItemTerminalityClassified {
        pub terminal: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct BlockerSatisfactionClassified {
        pub satisfied: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CreateStatusAdmissionClassified {
        pub admission: WorkCreateStatusAdmissionKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CreateCompletionPolicyAdmissionClassified {
        pub admission: WorkCreateCompletionPolicyAdmissionKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CloseStatusAdmissionClassified {
        pub admission: WorkCloseStatusAdmissionKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct PublicConfirmationAdmissionClassified {
        pub admission: WorkPublicConfirmationAdmissionKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CompletionPolicyMutationAdmissionClassified {
        pub admission: WorkCompletionPolicyMutationAdmissionKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ConfirmationAdmissionClassified {
        pub admission: WorkConfirmationAdmissionKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct WorkItemReadinessClassified {
        pub ready: bool,
    }
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Effect {
    Created(effects::Created),
    Updated(effects::Updated),
    Claimed(effects::Claimed),
    Released(effects::Released),
    Blocked(effects::Blocked),
    LinkValidated(effects::LinkValidated),
    Closed(effects::Closed),
    EvidenceAdded(effects::EvidenceAdded),
    WorkGraphPublicErrorClassified(effects::WorkGraphPublicErrorClassified),
    WorkItemTerminalityClassified(effects::WorkItemTerminalityClassified),
    BlockerSatisfactionClassified(effects::BlockerSatisfactionClassified),
    CreateStatusAdmissionClassified(effects::CreateStatusAdmissionClassified),
    CreateCompletionPolicyAdmissionClassified(effects::CreateCompletionPolicyAdmissionClassified),
    CloseStatusAdmissionClassified(effects::CloseStatusAdmissionClassified),
    PublicConfirmationAdmissionClassified(effects::PublicConfirmationAdmissionClassified),
    CompletionPolicyMutationAdmissionClassified(
        effects::CompletionPolicyMutationAdmissionClassified,
    ),
    ConfirmationAdmissionClassified(effects::ConfirmationAdmissionClassified),
    WorkItemReadinessClassified(effects::WorkItemReadinessClassified),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum EffectKind {
    Created,
    Updated,
    Claimed,
    Released,
    Blocked,
    LinkValidated,
    Closed,
    EvidenceAdded,
    WorkGraphPublicErrorClassified,
    WorkItemTerminalityClassified,
    BlockerSatisfactionClassified,
    CreateStatusAdmissionClassified,
    CreateCompletionPolicyAdmissionClassified,
    CloseStatusAdmissionClassified,
    PublicConfirmationAdmissionClassified,
    CompletionPolicyMutationAdmissionClassified,
    ConfirmationAdmissionClassified,
    WorkItemReadinessClassified,
}

#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TransitionId {
    CreateOpen,
    CreateBlocked,
    UpdateOpen,
    UpdateInProgress,
    UpdateBlocked,
    ClaimOpen,
    ClaimExpiredInProgress,
    ReleaseInProgress,
    BlockOpen,
    BlockInProgress,
    BlockBlocked,
    RefreshEligibilityOpen,
    RefreshEligibilityInProgress,
    RefreshEligibilityBlocked,
    ValidateLink,
    CloseOpenCompleted,
    CloseInProgressCompleted,
    CloseBlockedCompleted,
    CloseOpenCancelled,
    CloseInProgressCancelled,
    CloseBlockedCancelled,
    CloseOpenFailed,
    CloseInProgressFailed,
    CloseBlockedFailed,
    AddEvidenceOpen,
    AddEvidenceInProgress,
    AddEvidenceBlocked,
    AddEvidenceCompleted,
    AddEvidenceCancelled,
    AddEvidenceFailed,
    ClassifyPublicErrorNotFoundAbsent,
    ClassifyPublicErrorNotFoundOpen,
    ClassifyPublicErrorNotFoundInProgress,
    ClassifyPublicErrorNotFoundBlocked,
    ClassifyPublicErrorNotFoundCompleted,
    ClassifyPublicErrorNotFoundCancelled,
    ClassifyPublicErrorNotFoundFailed,
    ClassifyPublicErrorConflictAbsent,
    ClassifyPublicErrorConflictOpen,
    ClassifyPublicErrorConflictInProgress,
    ClassifyPublicErrorConflictBlocked,
    ClassifyPublicErrorConflictCompleted,
    ClassifyPublicErrorConflictCancelled,
    ClassifyPublicErrorConflictFailed,
    ClassifyPublicErrorInvalidTransitionAbsent,
    ClassifyPublicErrorInvalidTransitionOpen,
    ClassifyPublicErrorInvalidTransitionInProgress,
    ClassifyPublicErrorInvalidTransitionBlocked,
    ClassifyPublicErrorInvalidTransitionCompleted,
    ClassifyPublicErrorInvalidTransitionCancelled,
    ClassifyPublicErrorInvalidTransitionFailed,
    ClassifyPublicErrorInvalidArgumentsAbsent,
    ClassifyPublicErrorInvalidArgumentsOpen,
    ClassifyPublicErrorInvalidArgumentsInProgress,
    ClassifyPublicErrorInvalidArgumentsBlocked,
    ClassifyPublicErrorInvalidArgumentsCompleted,
    ClassifyPublicErrorInvalidArgumentsCancelled,
    ClassifyPublicErrorInvalidArgumentsFailed,
    ClassifyPublicErrorCapabilityUnavailableAbsent,
    ClassifyPublicErrorCapabilityUnavailableOpen,
    ClassifyPublicErrorCapabilityUnavailableInProgress,
    ClassifyPublicErrorCapabilityUnavailableBlocked,
    ClassifyPublicErrorCapabilityUnavailableCompleted,
    ClassifyPublicErrorCapabilityUnavailableCancelled,
    ClassifyPublicErrorCapabilityUnavailableFailed,
    ClassifyPublicErrorStoreErrorAbsent,
    ClassifyPublicErrorStoreErrorOpen,
    ClassifyPublicErrorStoreErrorInProgress,
    ClassifyPublicErrorStoreErrorBlocked,
    ClassifyPublicErrorStoreErrorCompleted,
    ClassifyPublicErrorStoreErrorCancelled,
    ClassifyPublicErrorStoreErrorFailed,
    ClassifyTerminalityTerminalCompleted,
    ClassifyTerminalityTerminalCancelled,
    ClassifyTerminalityTerminalFailed,
    ClassifyTerminalityLiveAbsent,
    ClassifyTerminalityLiveOpen,
    ClassifyTerminalityLiveInProgress,
    ClassifyTerminalityLiveBlocked,
    ClassifyReadinessOpenOpen,
    ClassifyReadinessInProgressInProgress,
    ClassifyReadinessNotClaimableAbsent,
    ClassifyReadinessNotClaimableBlocked,
    ClassifyReadinessNotClaimableCompleted,
    ClassifyReadinessNotClaimableCancelled,
    ClassifyReadinessNotClaimableFailed,
    ClassifyBlockerSatisfactionAbsent,
    ClassifyBlockerSatisfactionOpen,
    ClassifyBlockerSatisfactionInProgress,
    ClassifyBlockerSatisfactionBlocked,
    ClassifyBlockerSatisfactionCompleted,
    ClassifyBlockerSatisfactionCancelled,
    ClassifyBlockerSatisfactionFailed,
    ClassifyCreateStatusAdmissionOpenAbsent,
    ClassifyCreateStatusAdmissionOpenOpen,
    ClassifyCreateStatusAdmissionOpenInProgress,
    ClassifyCreateStatusAdmissionOpenBlocked,
    ClassifyCreateStatusAdmissionOpenCompleted,
    ClassifyCreateStatusAdmissionOpenCancelled,
    ClassifyCreateStatusAdmissionOpenFailed,
    ClassifyCreateStatusAdmissionBlockedAbsent,
    ClassifyCreateStatusAdmissionBlockedOpen,
    ClassifyCreateStatusAdmissionBlockedInProgress,
    ClassifyCreateStatusAdmissionBlockedBlocked,
    ClassifyCreateStatusAdmissionBlockedCompleted,
    ClassifyCreateStatusAdmissionBlockedCancelled,
    ClassifyCreateStatusAdmissionBlockedFailed,
    ClassifyCreateStatusAdmissionDeniedAbsentAbsent,
    ClassifyCreateStatusAdmissionDeniedAbsentOpen,
    ClassifyCreateStatusAdmissionDeniedAbsentInProgress,
    ClassifyCreateStatusAdmissionDeniedAbsentBlocked,
    ClassifyCreateStatusAdmissionDeniedAbsentCompleted,
    ClassifyCreateStatusAdmissionDeniedAbsentCancelled,
    ClassifyCreateStatusAdmissionDeniedAbsentFailed,
    ClassifyCreateStatusAdmissionDeniedInProgressAbsent,
    ClassifyCreateStatusAdmissionDeniedInProgressOpen,
    ClassifyCreateStatusAdmissionDeniedInProgressInProgress,
    ClassifyCreateStatusAdmissionDeniedInProgressBlocked,
    ClassifyCreateStatusAdmissionDeniedInProgressCompleted,
    ClassifyCreateStatusAdmissionDeniedInProgressCancelled,
    ClassifyCreateStatusAdmissionDeniedInProgressFailed,
    ClassifyCreateStatusAdmissionDeniedCompletedAbsent,
    ClassifyCreateStatusAdmissionDeniedCompletedOpen,
    ClassifyCreateStatusAdmissionDeniedCompletedInProgress,
    ClassifyCreateStatusAdmissionDeniedCompletedBlocked,
    ClassifyCreateStatusAdmissionDeniedCompletedCompleted,
    ClassifyCreateStatusAdmissionDeniedCompletedCancelled,
    ClassifyCreateStatusAdmissionDeniedCompletedFailed,
    ClassifyCreateStatusAdmissionDeniedCancelledAbsent,
    ClassifyCreateStatusAdmissionDeniedCancelledOpen,
    ClassifyCreateStatusAdmissionDeniedCancelledInProgress,
    ClassifyCreateStatusAdmissionDeniedCancelledBlocked,
    ClassifyCreateStatusAdmissionDeniedCancelledCompleted,
    ClassifyCreateStatusAdmissionDeniedCancelledCancelled,
    ClassifyCreateStatusAdmissionDeniedCancelledFailed,
    ClassifyCreateStatusAdmissionDeniedFailedAbsent,
    ClassifyCreateStatusAdmissionDeniedFailedOpen,
    ClassifyCreateStatusAdmissionDeniedFailedInProgress,
    ClassifyCreateStatusAdmissionDeniedFailedBlocked,
    ClassifyCreateStatusAdmissionDeniedFailedCompleted,
    ClassifyCreateStatusAdmissionDeniedFailedCancelled,
    ClassifyCreateStatusAdmissionDeniedFailedFailed,
    ClassifyCreateCompletionPolicyAdmissionSelfAttestAbsent,
    ClassifyCreateCompletionPolicyAdmissionSelfAttestOpen,
    ClassifyCreateCompletionPolicyAdmissionSelfAttestInProgress,
    ClassifyCreateCompletionPolicyAdmissionSelfAttestBlocked,
    ClassifyCreateCompletionPolicyAdmissionSelfAttestCompleted,
    ClassifyCreateCompletionPolicyAdmissionSelfAttestCancelled,
    ClassifyCreateCompletionPolicyAdmissionSelfAttestFailed,
    ClassifyCreateCompletionPolicyAdmissionHostConfirmedAbsent,
    ClassifyCreateCompletionPolicyAdmissionHostConfirmedOpen,
    ClassifyCreateCompletionPolicyAdmissionHostConfirmedInProgress,
    ClassifyCreateCompletionPolicyAdmissionHostConfirmedBlocked,
    ClassifyCreateCompletionPolicyAdmissionHostConfirmedCompleted,
    ClassifyCreateCompletionPolicyAdmissionHostConfirmedCancelled,
    ClassifyCreateCompletionPolicyAdmissionHostConfirmedFailed,
    ClassifyCreateCompletionPolicyAdmissionPrincipalConfirmedAbsent,
    ClassifyCreateCompletionPolicyAdmissionPrincipalConfirmedOpen,
    ClassifyCreateCompletionPolicyAdmissionPrincipalConfirmedInProgress,
    ClassifyCreateCompletionPolicyAdmissionPrincipalConfirmedBlocked,
    ClassifyCreateCompletionPolicyAdmissionPrincipalConfirmedCompleted,
    ClassifyCreateCompletionPolicyAdmissionPrincipalConfirmedCancelled,
    ClassifyCreateCompletionPolicyAdmissionPrincipalConfirmedFailed,
    ClassifyCreateCompletionPolicyAdmissionSupervisorAbsent,
    ClassifyCreateCompletionPolicyAdmissionSupervisorOpen,
    ClassifyCreateCompletionPolicyAdmissionSupervisorInProgress,
    ClassifyCreateCompletionPolicyAdmissionSupervisorBlocked,
    ClassifyCreateCompletionPolicyAdmissionSupervisorCompleted,
    ClassifyCreateCompletionPolicyAdmissionSupervisorCancelled,
    ClassifyCreateCompletionPolicyAdmissionSupervisorFailed,
    ClassifyCreateCompletionPolicyAdmissionReviewerQuorumAbsent,
    ClassifyCreateCompletionPolicyAdmissionReviewerQuorumOpen,
    ClassifyCreateCompletionPolicyAdmissionReviewerQuorumInProgress,
    ClassifyCreateCompletionPolicyAdmissionReviewerQuorumBlocked,
    ClassifyCreateCompletionPolicyAdmissionReviewerQuorumCompleted,
    ClassifyCreateCompletionPolicyAdmissionReviewerQuorumCancelled,
    ClassifyCreateCompletionPolicyAdmissionReviewerQuorumFailed,
    ClassifyCloseStatusAdmissionCompletedAbsent,
    ClassifyCloseStatusAdmissionCompletedOpen,
    ClassifyCloseStatusAdmissionCompletedInProgress,
    ClassifyCloseStatusAdmissionCompletedBlocked,
    ClassifyCloseStatusAdmissionCompletedCompleted,
    ClassifyCloseStatusAdmissionCompletedCancelled,
    ClassifyCloseStatusAdmissionCompletedFailed,
    ClassifyCloseStatusAdmissionCancelledAbsent,
    ClassifyCloseStatusAdmissionCancelledOpen,
    ClassifyCloseStatusAdmissionCancelledInProgress,
    ClassifyCloseStatusAdmissionCancelledBlocked,
    ClassifyCloseStatusAdmissionCancelledCompleted,
    ClassifyCloseStatusAdmissionCancelledCancelled,
    ClassifyCloseStatusAdmissionCancelledFailed,
    ClassifyCloseStatusAdmissionFailedAbsent,
    ClassifyCloseStatusAdmissionFailedOpen,
    ClassifyCloseStatusAdmissionFailedInProgress,
    ClassifyCloseStatusAdmissionFailedBlocked,
    ClassifyCloseStatusAdmissionFailedCompleted,
    ClassifyCloseStatusAdmissionFailedCancelled,
    ClassifyCloseStatusAdmissionFailedFailed,
    ClassifyCloseStatusAdmissionDeniedAbsentAbsent,
    ClassifyCloseStatusAdmissionDeniedAbsentOpen,
    ClassifyCloseStatusAdmissionDeniedAbsentInProgress,
    ClassifyCloseStatusAdmissionDeniedAbsentBlocked,
    ClassifyCloseStatusAdmissionDeniedAbsentCompleted,
    ClassifyCloseStatusAdmissionDeniedAbsentCancelled,
    ClassifyCloseStatusAdmissionDeniedAbsentFailed,
    ClassifyCloseStatusAdmissionDeniedOpenAbsent,
    ClassifyCloseStatusAdmissionDeniedOpenOpen,
    ClassifyCloseStatusAdmissionDeniedOpenInProgress,
    ClassifyCloseStatusAdmissionDeniedOpenBlocked,
    ClassifyCloseStatusAdmissionDeniedOpenCompleted,
    ClassifyCloseStatusAdmissionDeniedOpenCancelled,
    ClassifyCloseStatusAdmissionDeniedOpenFailed,
    ClassifyCloseStatusAdmissionDeniedInProgressAbsent,
    ClassifyCloseStatusAdmissionDeniedInProgressOpen,
    ClassifyCloseStatusAdmissionDeniedInProgressInProgress,
    ClassifyCloseStatusAdmissionDeniedInProgressBlocked,
    ClassifyCloseStatusAdmissionDeniedInProgressCompleted,
    ClassifyCloseStatusAdmissionDeniedInProgressCancelled,
    ClassifyCloseStatusAdmissionDeniedInProgressFailed,
    ClassifyCloseStatusAdmissionDeniedBlockedAbsent,
    ClassifyCloseStatusAdmissionDeniedBlockedOpen,
    ClassifyCloseStatusAdmissionDeniedBlockedInProgress,
    ClassifyCloseStatusAdmissionDeniedBlockedBlocked,
    ClassifyCloseStatusAdmissionDeniedBlockedCompleted,
    ClassifyCloseStatusAdmissionDeniedBlockedCancelled,
    ClassifyCloseStatusAdmissionDeniedBlockedFailed,
    ClassifyPublicConfirmationAdmissionSelfAttestAbsent,
    ClassifyPublicConfirmationAdmissionSelfAttestOpen,
    ClassifyPublicConfirmationAdmissionSelfAttestInProgress,
    ClassifyPublicConfirmationAdmissionSelfAttestBlocked,
    ClassifyPublicConfirmationAdmissionSelfAttestCompleted,
    ClassifyPublicConfirmationAdmissionSelfAttestCancelled,
    ClassifyPublicConfirmationAdmissionSelfAttestFailed,
    ClassifyPublicConfirmationAdmissionHostConfirmedAbsent,
    ClassifyPublicConfirmationAdmissionHostConfirmedOpen,
    ClassifyPublicConfirmationAdmissionHostConfirmedInProgress,
    ClassifyPublicConfirmationAdmissionHostConfirmedBlocked,
    ClassifyPublicConfirmationAdmissionHostConfirmedCompleted,
    ClassifyPublicConfirmationAdmissionHostConfirmedCancelled,
    ClassifyPublicConfirmationAdmissionHostConfirmedFailed,
    ClassifyPublicConfirmationAdmissionPrincipalConfirmedAbsent,
    ClassifyPublicConfirmationAdmissionPrincipalConfirmedOpen,
    ClassifyPublicConfirmationAdmissionPrincipalConfirmedInProgress,
    ClassifyPublicConfirmationAdmissionPrincipalConfirmedBlocked,
    ClassifyPublicConfirmationAdmissionPrincipalConfirmedCompleted,
    ClassifyPublicConfirmationAdmissionPrincipalConfirmedCancelled,
    ClassifyPublicConfirmationAdmissionPrincipalConfirmedFailed,
    ClassifyPublicConfirmationAdmissionSupervisorAbsent,
    ClassifyPublicConfirmationAdmissionSupervisorOpen,
    ClassifyPublicConfirmationAdmissionSupervisorInProgress,
    ClassifyPublicConfirmationAdmissionSupervisorBlocked,
    ClassifyPublicConfirmationAdmissionSupervisorCompleted,
    ClassifyPublicConfirmationAdmissionSupervisorCancelled,
    ClassifyPublicConfirmationAdmissionSupervisorFailed,
    ClassifyPublicConfirmationAdmissionReviewerQuorumAbsent,
    ClassifyPublicConfirmationAdmissionReviewerQuorumOpen,
    ClassifyPublicConfirmationAdmissionReviewerQuorumInProgress,
    ClassifyPublicConfirmationAdmissionReviewerQuorumBlocked,
    ClassifyPublicConfirmationAdmissionReviewerQuorumCompleted,
    ClassifyPublicConfirmationAdmissionReviewerQuorumCancelled,
    ClassifyPublicConfirmationAdmissionReviewerQuorumFailed,
    ClassifyCompletionPolicyMutationAdmissionUnchangedAbsent,
    ClassifyCompletionPolicyMutationAdmissionUnchangedOpen,
    ClassifyCompletionPolicyMutationAdmissionUnchangedInProgress,
    ClassifyCompletionPolicyMutationAdmissionUnchangedBlocked,
    ClassifyCompletionPolicyMutationAdmissionUnchangedCompleted,
    ClassifyCompletionPolicyMutationAdmissionUnchangedCancelled,
    ClassifyCompletionPolicyMutationAdmissionUnchangedFailed,
    ClassifyCompletionPolicyMutationAdmissionChangedAbsent,
    ClassifyCompletionPolicyMutationAdmissionChangedOpen,
    ClassifyCompletionPolicyMutationAdmissionChangedInProgress,
    ClassifyCompletionPolicyMutationAdmissionChangedBlocked,
    ClassifyCompletionPolicyMutationAdmissionChangedCompleted,
    ClassifyCompletionPolicyMutationAdmissionChangedCancelled,
    ClassifyCompletionPolicyMutationAdmissionChangedFailed,
    ClassifyConfirmationAdmissionPrincipalRequiredAbsent,
    ClassifyConfirmationAdmissionPrincipalRequiredOpen,
    ClassifyConfirmationAdmissionPrincipalRequiredInProgress,
    ClassifyConfirmationAdmissionPrincipalRequiredBlocked,
    ClassifyConfirmationAdmissionPrincipalRequiredCompleted,
    ClassifyConfirmationAdmissionPrincipalRequiredCancelled,
    ClassifyConfirmationAdmissionPrincipalRequiredFailed,
    ClassifyConfirmationAdmissionPrincipalKindMismatchAbsent,
    ClassifyConfirmationAdmissionPrincipalKindMismatchOpen,
    ClassifyConfirmationAdmissionPrincipalKindMismatchInProgress,
    ClassifyConfirmationAdmissionPrincipalKindMismatchBlocked,
    ClassifyConfirmationAdmissionPrincipalKindMismatchCompleted,
    ClassifyConfirmationAdmissionPrincipalKindMismatchCancelled,
    ClassifyConfirmationAdmissionPrincipalKindMismatchFailed,
    ClassifyConfirmationAdmissionSupervisorMismatchAbsent,
    ClassifyConfirmationAdmissionSupervisorMismatchOpen,
    ClassifyConfirmationAdmissionSupervisorMismatchInProgress,
    ClassifyConfirmationAdmissionSupervisorMismatchBlocked,
    ClassifyConfirmationAdmissionSupervisorMismatchCompleted,
    ClassifyConfirmationAdmissionSupervisorMismatchCancelled,
    ClassifyConfirmationAdmissionSupervisorMismatchFailed,
    ClassifyConfirmationAdmissionSelfAttestEmptyAbsent,
    ClassifyConfirmationAdmissionSelfAttestEmptyOpen,
    ClassifyConfirmationAdmissionSelfAttestEmptyInProgress,
    ClassifyConfirmationAdmissionSelfAttestEmptyBlocked,
    ClassifyConfirmationAdmissionSelfAttestEmptyCompleted,
    ClassifyConfirmationAdmissionSelfAttestEmptyCancelled,
    ClassifyConfirmationAdmissionSelfAttestEmptyFailed,
    ClassifyConfirmationAdmissionEvidenceKindAbsent,
    ClassifyConfirmationAdmissionEvidenceKindOpen,
    ClassifyConfirmationAdmissionEvidenceKindInProgress,
    ClassifyConfirmationAdmissionEvidenceKindBlocked,
    ClassifyConfirmationAdmissionEvidenceKindCompleted,
    ClassifyConfirmationAdmissionEvidenceKindCancelled,
    ClassifyConfirmationAdmissionEvidenceKindFailed,
    ClassifyConfirmationAdmissionAdmittedAbsent,
    ClassifyConfirmationAdmissionAdmittedOpen,
    ClassifyConfirmationAdmissionAdmittedInProgress,
    ClassifyConfirmationAdmissionAdmittedBlocked,
    ClassifyConfirmationAdmissionAdmittedCompleted,
    ClassifyConfirmationAdmissionAdmittedCancelled,
    ClassifyConfirmationAdmissionAdmittedFailed,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum GuardId {
    None,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum HelperId {
    None,
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct GuardRejection {
    pub transition_id: TransitionId,
    pub guard_id: GuardId,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TriggerDiscriminant {
    Input(InputKind),
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TransitionRefusal {
    NoMatchingTransition {
        phase: Phase,
        trigger: TriggerDiscriminant,
    },
    GuardRejected {
        rejections: Vec<GuardRejection>,
    },
    AmbiguousTransition {
        transitions: Vec<TransitionId>,
    },
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum KernelError {
    ContextViolation {
        transition_id: TransitionId,
        detail: String,
    },
    HelperEvaluation {
        helper_id: HelperId,
        detail: String,
    },
    CodegenInvariant {
        detail: String,
    },
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TransitionError {
    Refusal(TransitionRefusal),
    Kernel(KernelError),
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Outcome {
    pub transition_id: TransitionId,
    pub next_state: State,
    pub effects: Vec<Effect>,
}

pub mod helpers {
    #[allow(unused_imports)]
    use super::*;
    pub fn none<C: Context>(_: &State, context: &C) -> Result<(), KernelError> {
        let _ = context;
        Ok(())
    }
}

pub fn initial_state() -> State {
    State {
        phase: Phase::Absent,
        revision: 0,
        unresolved_blocker_count: 0,
        topology_item_keys: Default::default(),
        topology_edge_keys: Default::default(),
        blocks_reachability: Default::default(),
        parent_reachability: Default::default(),
        claim_owner_key: None,
        claimed_at_utc_ms: None,
        lease_expires_at_utc_ms: None,
        due_at_utc_ms: None,
        not_before_utc_ms: None,
        snoozed_until_utc_ms: None,
        completion_policy: WorkCompletionPolicy::SelfAttest,
        completion_supervisor_owner_key: None,
        completion_reviewer_quorum_threshold: None,
        terminal_at_utc_ms: None,
        evidence_count: 0,
        host_confirmation_count: 0,
        principal_confirmation_count: 0,
        supervisor_confirmation_owner_keys: Default::default(),
        reviewer_confirmation_owner_keys: Default::default(),
    }
}
