// @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_occurrence_lifecycle_machine()
}

#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct ClaimOwner(pub String);
impl From<String> for ClaimOwner {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for ClaimOwner {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for ClaimOwner {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct ClaimToken(pub String);
impl From<String> for ClaimToken {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for ClaimToken {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for ClaimToken {
    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 ClaimedDispatchDisposition {
    #[default]
    #[serde(rename = "Frozen")]
    Frozen,
    #[serde(rename = "Supersede")]
    Supersede,
    #[serde(rename = "Ready")]
    Ready,
    #[serde(rename = "FutureRevision")]
    FutureRevision,
}
impl ClaimedDispatchDisposition {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Frozen => "Frozen",
            Self::Supersede => "Supersede",
            Self::Ready => "Ready",
            Self::FutureRevision => "FutureRevision",
        }
    }
}
impl std::convert::TryFrom<&str> for ClaimedDispatchDisposition {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Frozen" => Ok(Self::Frozen),
            "Supersede" => Ok(Self::Supersede),
            "Ready" => Ok(Self::Ready),
            "FutureRevision" => Ok(Self::FutureRevision),
            other => Err(format!(
                "invalid ClaimedDispatchDisposition value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for ClaimedDispatchDisposition {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for ClaimedDispatchDisposition {
    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 ClaimedDispatchSchedulePhase {
    #[default]
    #[serde(rename = "Active")]
    Active,
    #[serde(rename = "Paused")]
    Paused,
    #[serde(rename = "Deleted")]
    Deleted,
}
impl ClaimedDispatchSchedulePhase {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Active => "Active",
            Self::Paused => "Paused",
            Self::Deleted => "Deleted",
        }
    }
}
impl std::convert::TryFrom<&str> for ClaimedDispatchSchedulePhase {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Active" => Ok(Self::Active),
            "Paused" => Ok(Self::Paused),
            "Deleted" => Ok(Self::Deleted),
            other => Err(format!(
                "invalid ClaimedDispatchSchedulePhase value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for ClaimedDispatchSchedulePhase {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for ClaimedDispatchSchedulePhase {
    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 CompletionSupersessionDisposition {
    #[default]
    #[serde(rename = "Supersede")]
    Supersede,
    #[serde(rename = "Proceed")]
    Proceed,
    #[serde(rename = "AlreadySuperseded")]
    AlreadySuperseded,
}
impl CompletionSupersessionDisposition {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Supersede => "Supersede",
            Self::Proceed => "Proceed",
            Self::AlreadySuperseded => "AlreadySuperseded",
        }
    }
}
impl std::convert::TryFrom<&str> for CompletionSupersessionDisposition {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Supersede" => Ok(Self::Supersede),
            "Proceed" => Ok(Self::Proceed),
            "AlreadySuperseded" => Ok(Self::AlreadySuperseded),
            other => Err(format!(
                "invalid CompletionSupersessionDisposition value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for CompletionSupersessionDisposition {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for CompletionSupersessionDisposition {
    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 CorrelationId(pub String);
impl From<String> for CorrelationId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for CorrelationId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for CorrelationId {
    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 DeliveryCompletionFailureReason {
    #[default]
    #[serde(rename = "CompletionFutureFailed")]
    CompletionFutureFailed,
    #[serde(rename = "RuntimeCompletionChannelClosed")]
    RuntimeCompletionChannelClosed,
    #[serde(rename = "RuntimeCompletionAuthorityUnavailable")]
    RuntimeCompletionAuthorityUnavailable,
    #[serde(rename = "RuntimeCompletionHandleMissing")]
    RuntimeCompletionHandleMissing,
}
impl DeliveryCompletionFailureReason {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::CompletionFutureFailed => "CompletionFutureFailed",
            Self::RuntimeCompletionChannelClosed => "RuntimeCompletionChannelClosed",
            Self::RuntimeCompletionAuthorityUnavailable => "RuntimeCompletionAuthorityUnavailable",
            Self::RuntimeCompletionHandleMissing => "RuntimeCompletionHandleMissing",
        }
    }
}
impl std::convert::TryFrom<&str> for DeliveryCompletionFailureReason {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "CompletionFutureFailed" => Ok(Self::CompletionFutureFailed),
            "RuntimeCompletionChannelClosed" => Ok(Self::RuntimeCompletionChannelClosed),
            "RuntimeCompletionAuthorityUnavailable" => {
                Ok(Self::RuntimeCompletionAuthorityUnavailable)
            }
            "RuntimeCompletionHandleMissing" => Ok(Self::RuntimeCompletionHandleMissing),
            other => Err(format!(
                "invalid DeliveryCompletionFailureReason value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for DeliveryCompletionFailureReason {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for DeliveryCompletionFailureReason {
    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 DeliveryFailureReason {
    #[default]
    #[serde(rename = "TargetMaterializationFailed")]
    TargetMaterializationFailed,
    #[serde(rename = "TargetMissing")]
    TargetMissing,
    #[serde(rename = "TargetBusy")]
    TargetBusy,
    #[serde(rename = "RuntimeRejected")]
    RuntimeRejected,
    #[serde(rename = "MobRejected")]
    MobRejected,
    #[serde(rename = "TransportError")]
    TransportError,
    #[serde(rename = "InternalError")]
    InternalError,
}
impl DeliveryFailureReason {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::TargetMaterializationFailed => "TargetMaterializationFailed",
            Self::TargetMissing => "TargetMissing",
            Self::TargetBusy => "TargetBusy",
            Self::RuntimeRejected => "RuntimeRejected",
            Self::MobRejected => "MobRejected",
            Self::TransportError => "TransportError",
            Self::InternalError => "InternalError",
        }
    }
}
impl std::convert::TryFrom<&str> for DeliveryFailureReason {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "TargetMaterializationFailed" => Ok(Self::TargetMaterializationFailed),
            "TargetMissing" => Ok(Self::TargetMissing),
            "TargetBusy" => Ok(Self::TargetBusy),
            "RuntimeRejected" => Ok(Self::RuntimeRejected),
            "MobRejected" => Ok(Self::MobRejected),
            "TransportError" => Ok(Self::TransportError),
            "InternalError" => Ok(Self::InternalError),
            other => Err(format!("invalid DeliveryFailureReason value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for DeliveryFailureReason {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for DeliveryFailureReason {
    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 DeliveryReceiptStage {
    #[default]
    #[serde(rename = "Planned")]
    Planned,
    #[serde(rename = "Claimed")]
    Claimed,
    #[serde(rename = "DispatchStarted")]
    DispatchStarted,
    #[serde(rename = "DispatchAccepted")]
    DispatchAccepted,
    #[serde(rename = "AwaitingCompletion")]
    AwaitingCompletion,
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Skipped")]
    Skipped,
    #[serde(rename = "Misfired")]
    Misfired,
    #[serde(rename = "Superseded")]
    Superseded,
    #[serde(rename = "DeliveryFailed")]
    DeliveryFailed,
    #[serde(rename = "LeaseExpired")]
    LeaseExpired,
}
impl DeliveryReceiptStage {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Planned => "Planned",
            Self::Claimed => "Claimed",
            Self::DispatchStarted => "DispatchStarted",
            Self::DispatchAccepted => "DispatchAccepted",
            Self::AwaitingCompletion => "AwaitingCompletion",
            Self::Completed => "Completed",
            Self::Skipped => "Skipped",
            Self::Misfired => "Misfired",
            Self::Superseded => "Superseded",
            Self::DeliveryFailed => "DeliveryFailed",
            Self::LeaseExpired => "LeaseExpired",
        }
    }
}
impl std::convert::TryFrom<&str> for DeliveryReceiptStage {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Planned" => Ok(Self::Planned),
            "Claimed" => Ok(Self::Claimed),
            "DispatchStarted" => Ok(Self::DispatchStarted),
            "DispatchAccepted" => Ok(Self::DispatchAccepted),
            "AwaitingCompletion" => Ok(Self::AwaitingCompletion),
            "Completed" => Ok(Self::Completed),
            "Skipped" => Ok(Self::Skipped),
            "Misfired" => Ok(Self::Misfired),
            "Superseded" => Ok(Self::Superseded),
            "DeliveryFailed" => Ok(Self::DeliveryFailed),
            "LeaseExpired" => Ok(Self::LeaseExpired),
            other => Err(format!("invalid DeliveryReceiptStage value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for DeliveryReceiptStage {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for DeliveryReceiptStage {
    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 LateCompletionResolutionClass {
    #[default]
    #[serde(rename = "DeliveryCompleted")]
    DeliveryCompleted,
    #[serde(rename = "RuntimeCompleted")]
    RuntimeCompleted,
    #[serde(rename = "RuntimeRejected")]
    RuntimeRejected,
    #[serde(rename = "RuntimeTransportError")]
    RuntimeTransportError,
    #[serde(rename = "RuntimeInternalError")]
    RuntimeInternalError,
    #[serde(rename = "DeliveryCompletionFailed")]
    DeliveryCompletionFailed,
    #[serde(rename = "DeliveryFailed")]
    DeliveryFailed,
}
impl LateCompletionResolutionClass {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::DeliveryCompleted => "DeliveryCompleted",
            Self::RuntimeCompleted => "RuntimeCompleted",
            Self::RuntimeRejected => "RuntimeRejected",
            Self::RuntimeTransportError => "RuntimeTransportError",
            Self::RuntimeInternalError => "RuntimeInternalError",
            Self::DeliveryCompletionFailed => "DeliveryCompletionFailed",
            Self::DeliveryFailed => "DeliveryFailed",
        }
    }
}
impl std::convert::TryFrom<&str> for LateCompletionResolutionClass {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "DeliveryCompleted" => Ok(Self::DeliveryCompleted),
            "RuntimeCompleted" => Ok(Self::RuntimeCompleted),
            "RuntimeRejected" => Ok(Self::RuntimeRejected),
            "RuntimeTransportError" => Ok(Self::RuntimeTransportError),
            "RuntimeInternalError" => Ok(Self::RuntimeInternalError),
            "DeliveryCompletionFailed" => Ok(Self::DeliveryCompletionFailed),
            "DeliveryFailed" => Ok(Self::DeliveryFailed),
            other => Err(format!(
                "invalid LateCompletionResolutionClass value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for LateCompletionResolutionClass {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for LateCompletionResolutionClass {
    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 MisfirePolicy {
    #[default]
    #[serde(rename = "Skip")]
    Skip,
    #[serde(rename = "CatchUpWithin")]
    CatchUpWithin,
}
impl MisfirePolicy {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Skip => "Skip",
            Self::CatchUpWithin => "CatchUpWithin",
        }
    }
}
impl std::convert::TryFrom<&str> for MisfirePolicy {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Skip" => Ok(Self::Skip),
            "CatchUpWithin" => Ok(Self::CatchUpWithin),
            other => Err(format!("invalid MisfirePolicy value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for MisfirePolicy {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for MisfirePolicy {
    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 MissingTargetPolicy {
    #[default]
    #[serde(rename = "MarkMisfired")]
    MarkMisfired,
    #[serde(rename = "Skip")]
    Skip,
}
impl MissingTargetPolicy {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::MarkMisfired => "MarkMisfired",
            Self::Skip => "Skip",
        }
    }
}
impl std::convert::TryFrom<&str> for MissingTargetPolicy {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "MarkMisfired" => Ok(Self::MarkMisfired),
            "Skip" => Ok(Self::Skip),
            other => Err(format!("invalid MissingTargetPolicy value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for MissingTargetPolicy {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for MissingTargetPolicy {
    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 OccurrenceFailureClass {
    #[default]
    #[serde(rename = "TargetMaterializationFailed")]
    TargetMaterializationFailed,
    #[serde(rename = "TargetMissing")]
    TargetMissing,
    #[serde(rename = "TargetBusy")]
    TargetBusy,
    #[serde(rename = "RuntimeRejected")]
    RuntimeRejected,
    #[serde(rename = "MobRejected")]
    MobRejected,
    #[serde(rename = "LeaseLost")]
    LeaseLost,
    #[serde(rename = "TransportError")]
    TransportError,
    #[serde(rename = "InternalError")]
    InternalError,
}
impl OccurrenceFailureClass {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::TargetMaterializationFailed => "TargetMaterializationFailed",
            Self::TargetMissing => "TargetMissing",
            Self::TargetBusy => "TargetBusy",
            Self::RuntimeRejected => "RuntimeRejected",
            Self::MobRejected => "MobRejected",
            Self::LeaseLost => "LeaseLost",
            Self::TransportError => "TransportError",
            Self::InternalError => "InternalError",
        }
    }
}
impl std::convert::TryFrom<&str> for OccurrenceFailureClass {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "TargetMaterializationFailed" => Ok(Self::TargetMaterializationFailed),
            "TargetMissing" => Ok(Self::TargetMissing),
            "TargetBusy" => Ok(Self::TargetBusy),
            "RuntimeRejected" => Ok(Self::RuntimeRejected),
            "MobRejected" => Ok(Self::MobRejected),
            "LeaseLost" => Ok(Self::LeaseLost),
            "TransportError" => Ok(Self::TransportError),
            "InternalError" => Ok(Self::InternalError),
            other => Err(format!("invalid OccurrenceFailureClass value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for OccurrenceFailureClass {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OccurrenceFailureClass {
    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 OccurrenceId(pub String);
impl From<String> for OccurrenceId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for OccurrenceId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for OccurrenceId {
    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 OccurrenceLifecycleInputVariant {
    #[default]
    #[serde(rename = "PlanOccurrence")]
    PlanOccurrence,
    #[serde(rename = "SyncTargetSnapshot")]
    SyncTargetSnapshot,
    #[serde(rename = "RecordReceipt")]
    RecordReceipt,
    #[serde(rename = "ClassifyDue")]
    ClassifyDue,
    #[serde(rename = "ClassifyOccurrenceTerminality")]
    ClassifyOccurrenceTerminality,
    #[serde(rename = "ClassifyClaimedDispatchDisposition")]
    ClassifyClaimedDispatchDisposition,
    #[serde(rename = "ClassifyCompletionSupersession")]
    ClassifyCompletionSupersession,
    #[serde(rename = "Claim")]
    Claim,
    #[serde(rename = "DispatchStarted")]
    DispatchStarted,
    #[serde(rename = "AwaitCompletion")]
    AwaitCompletion,
    #[serde(rename = "Complete")]
    Complete,
    #[serde(rename = "ResolveRuntimeCompletion")]
    ResolveRuntimeCompletion,
    #[serde(rename = "ResolveDeliveryCompletionFailure")]
    ResolveDeliveryCompletionFailure,
    #[serde(rename = "ResolveDeliveryFailure")]
    ResolveDeliveryFailure,
    #[serde(rename = "ResolveTargetProbe")]
    ResolveTargetProbe,
    #[serde(rename = "ResolveDueMisfire")]
    ResolveDueMisfire,
    #[serde(rename = "Supersede")]
    Supersede,
    #[serde(rename = "LeaseExpired")]
    LeaseExpired,
    #[serde(rename = "ReleaseLeaseForPausedSchedule")]
    ReleaseLeaseForPausedSchedule,
    #[serde(rename = "ClassifyTransitionFailure")]
    ClassifyTransitionFailure,
    #[serde(rename = "ClassifyStaleCompletionArrival")]
    ClassifyStaleCompletionArrival,
}
impl OccurrenceLifecycleInputVariant {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::PlanOccurrence => "PlanOccurrence",
            Self::SyncTargetSnapshot => "SyncTargetSnapshot",
            Self::RecordReceipt => "RecordReceipt",
            Self::ClassifyDue => "ClassifyDue",
            Self::ClassifyOccurrenceTerminality => "ClassifyOccurrenceTerminality",
            Self::ClassifyClaimedDispatchDisposition => "ClassifyClaimedDispatchDisposition",
            Self::ClassifyCompletionSupersession => "ClassifyCompletionSupersession",
            Self::Claim => "Claim",
            Self::DispatchStarted => "DispatchStarted",
            Self::AwaitCompletion => "AwaitCompletion",
            Self::Complete => "Complete",
            Self::ResolveRuntimeCompletion => "ResolveRuntimeCompletion",
            Self::ResolveDeliveryCompletionFailure => "ResolveDeliveryCompletionFailure",
            Self::ResolveDeliveryFailure => "ResolveDeliveryFailure",
            Self::ResolveTargetProbe => "ResolveTargetProbe",
            Self::ResolveDueMisfire => "ResolveDueMisfire",
            Self::Supersede => "Supersede",
            Self::LeaseExpired => "LeaseExpired",
            Self::ReleaseLeaseForPausedSchedule => "ReleaseLeaseForPausedSchedule",
            Self::ClassifyTransitionFailure => "ClassifyTransitionFailure",
            Self::ClassifyStaleCompletionArrival => "ClassifyStaleCompletionArrival",
        }
    }
}
impl std::convert::TryFrom<&str> for OccurrenceLifecycleInputVariant {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "PlanOccurrence" => Ok(Self::PlanOccurrence),
            "SyncTargetSnapshot" => Ok(Self::SyncTargetSnapshot),
            "RecordReceipt" => Ok(Self::RecordReceipt),
            "ClassifyDue" => Ok(Self::ClassifyDue),
            "ClassifyOccurrenceTerminality" => Ok(Self::ClassifyOccurrenceTerminality),
            "ClassifyClaimedDispatchDisposition" => Ok(Self::ClassifyClaimedDispatchDisposition),
            "ClassifyCompletionSupersession" => Ok(Self::ClassifyCompletionSupersession),
            "Claim" => Ok(Self::Claim),
            "DispatchStarted" => Ok(Self::DispatchStarted),
            "AwaitCompletion" => Ok(Self::AwaitCompletion),
            "Complete" => Ok(Self::Complete),
            "ResolveRuntimeCompletion" => Ok(Self::ResolveRuntimeCompletion),
            "ResolveDeliveryCompletionFailure" => Ok(Self::ResolveDeliveryCompletionFailure),
            "ResolveDeliveryFailure" => Ok(Self::ResolveDeliveryFailure),
            "ResolveTargetProbe" => Ok(Self::ResolveTargetProbe),
            "ResolveDueMisfire" => Ok(Self::ResolveDueMisfire),
            "Supersede" => Ok(Self::Supersede),
            "LeaseExpired" => Ok(Self::LeaseExpired),
            "ReleaseLeaseForPausedSchedule" => Ok(Self::ReleaseLeaseForPausedSchedule),
            "ClassifyTransitionFailure" => Ok(Self::ClassifyTransitionFailure),
            "ClassifyStaleCompletionArrival" => Ok(Self::ClassifyStaleCompletionArrival),
            other => Err(format!(
                "invalid OccurrenceLifecycleInputVariant value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for OccurrenceLifecycleInputVariant {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OccurrenceLifecycleInputVariant {
    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 OccurrenceLifecycleState {
    #[default]
    #[serde(rename = "Pending")]
    Pending,
    #[serde(rename = "Claimed")]
    Claimed,
    #[serde(rename = "Dispatching")]
    Dispatching,
    #[serde(rename = "AwaitingCompletion")]
    AwaitingCompletion,
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "Skipped")]
    Skipped,
    #[serde(rename = "Misfired")]
    Misfired,
    #[serde(rename = "Superseded")]
    Superseded,
    #[serde(rename = "DeliveryFailed")]
    DeliveryFailed,
}
impl OccurrenceLifecycleState {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Pending => "Pending",
            Self::Claimed => "Claimed",
            Self::Dispatching => "Dispatching",
            Self::AwaitingCompletion => "AwaitingCompletion",
            Self::Completed => "Completed",
            Self::Skipped => "Skipped",
            Self::Misfired => "Misfired",
            Self::Superseded => "Superseded",
            Self::DeliveryFailed => "DeliveryFailed",
        }
    }
}
impl std::convert::TryFrom<&str> for OccurrenceLifecycleState {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Pending" => Ok(Self::Pending),
            "Claimed" => Ok(Self::Claimed),
            "Dispatching" => Ok(Self::Dispatching),
            "AwaitingCompletion" => Ok(Self::AwaitingCompletion),
            "Completed" => Ok(Self::Completed),
            "Skipped" => Ok(Self::Skipped),
            "Misfired" => Ok(Self::Misfired),
            "Superseded" => Ok(Self::Superseded),
            "DeliveryFailed" => Ok(Self::DeliveryFailed),
            other => Err(format!("invalid OccurrenceLifecycleState value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for OccurrenceLifecycleState {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OccurrenceLifecycleState {
    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 OccurrenceTargetProbeOutcome {
    #[default]
    #[serde(rename = "Ready")]
    Ready,
    #[serde(rename = "Busy")]
    Busy,
    #[serde(rename = "Missing")]
    Missing,
}
impl OccurrenceTargetProbeOutcome {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Ready => "Ready",
            Self::Busy => "Busy",
            Self::Missing => "Missing",
        }
    }
}
impl std::convert::TryFrom<&str> for OccurrenceTargetProbeOutcome {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Ready" => Ok(Self::Ready),
            "Busy" => Ok(Self::Busy),
            "Missing" => Ok(Self::Missing),
            other => Err(format!(
                "invalid OccurrenceTargetProbeOutcome value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for OccurrenceTargetProbeOutcome {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OccurrenceTargetProbeOutcome {
    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 OccurrenceTransitionFailureClassKind {
    #[default]
    #[serde(rename = "PlanRejected")]
    PlanRejected,
    #[serde(rename = "TargetSyncRejected")]
    TargetSyncRejected,
    #[serde(rename = "ReceiptRecordRejected")]
    ReceiptRecordRejected,
    #[serde(rename = "DueClassificationRejected")]
    DueClassificationRejected,
    #[serde(rename = "ClaimedDispatchClassificationRejected")]
    ClaimedDispatchClassificationRejected,
    #[serde(rename = "CompletionSupersessionClassificationRejected")]
    CompletionSupersessionClassificationRejected,
    #[serde(rename = "ClaimRejected")]
    ClaimRejected,
    #[serde(rename = "NotPendingForClaim")]
    NotPendingForClaim,
    #[serde(rename = "NotClaimed")]
    NotClaimed,
    #[serde(rename = "NotDispatching")]
    NotDispatching,
    #[serde(rename = "NotLeaseHolding")]
    NotLeaseHolding,
    #[serde(rename = "NotLiveForTerminal")]
    NotLiveForTerminal,
    #[serde(rename = "StaleCompletionArrivalClassificationRejected")]
    StaleCompletionArrivalClassificationRejected,
}
impl OccurrenceTransitionFailureClassKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::PlanRejected => "PlanRejected",
            Self::TargetSyncRejected => "TargetSyncRejected",
            Self::ReceiptRecordRejected => "ReceiptRecordRejected",
            Self::DueClassificationRejected => "DueClassificationRejected",
            Self::ClaimedDispatchClassificationRejected => "ClaimedDispatchClassificationRejected",
            Self::CompletionSupersessionClassificationRejected => {
                "CompletionSupersessionClassificationRejected"
            }
            Self::ClaimRejected => "ClaimRejected",
            Self::NotPendingForClaim => "NotPendingForClaim",
            Self::NotClaimed => "NotClaimed",
            Self::NotDispatching => "NotDispatching",
            Self::NotLeaseHolding => "NotLeaseHolding",
            Self::NotLiveForTerminal => "NotLiveForTerminal",
            Self::StaleCompletionArrivalClassificationRejected => {
                "StaleCompletionArrivalClassificationRejected"
            }
        }
    }
}
impl std::convert::TryFrom<&str> for OccurrenceTransitionFailureClassKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "PlanRejected" => Ok(Self::PlanRejected),
            "TargetSyncRejected" => Ok(Self::TargetSyncRejected),
            "ReceiptRecordRejected" => Ok(Self::ReceiptRecordRejected),
            "DueClassificationRejected" => Ok(Self::DueClassificationRejected),
            "ClaimedDispatchClassificationRejected" => {
                Ok(Self::ClaimedDispatchClassificationRejected)
            }
            "CompletionSupersessionClassificationRejected" => {
                Ok(Self::CompletionSupersessionClassificationRejected)
            }
            "ClaimRejected" => Ok(Self::ClaimRejected),
            "NotPendingForClaim" => Ok(Self::NotPendingForClaim),
            "NotClaimed" => Ok(Self::NotClaimed),
            "NotDispatching" => Ok(Self::NotDispatching),
            "NotLeaseHolding" => Ok(Self::NotLeaseHolding),
            "NotLiveForTerminal" => Ok(Self::NotLiveForTerminal),
            "StaleCompletionArrivalClassificationRejected" => {
                Ok(Self::StaleCompletionArrivalClassificationRejected)
            }
            other => Err(format!(
                "invalid OccurrenceTransitionFailureClassKind value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for OccurrenceTransitionFailureClassKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OccurrenceTransitionFailureClassKind {
    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 OccurrenceTransitionFailureRefusalKind {
    #[default]
    #[serde(rename = "NoMatchingTransition")]
    NoMatchingTransition,
    #[serde(rename = "GuardRejected")]
    GuardRejected,
}
impl OccurrenceTransitionFailureRefusalKind {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::NoMatchingTransition => "NoMatchingTransition",
            Self::GuardRejected => "GuardRejected",
        }
    }
}
impl std::convert::TryFrom<&str> for OccurrenceTransitionFailureRefusalKind {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "NoMatchingTransition" => Ok(Self::NoMatchingTransition),
            "GuardRejected" => Ok(Self::GuardRejected),
            other => Err(format!(
                "invalid OccurrenceTransitionFailureRefusalKind value `{other}`"
            )),
        }
    }
}
impl std::convert::TryFrom<String> for OccurrenceTransitionFailureRefusalKind {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OccurrenceTransitionFailureRefusalKind {
    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 OverlapPolicy {
    #[default]
    #[serde(rename = "AllowConcurrent")]
    AllowConcurrent,
    #[serde(rename = "SkipIfRunning")]
    SkipIfRunning,
}
impl OverlapPolicy {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::AllowConcurrent => "AllowConcurrent",
            Self::SkipIfRunning => "SkipIfRunning",
        }
    }
}
impl std::convert::TryFrom<&str> for OverlapPolicy {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "AllowConcurrent" => Ok(Self::AllowConcurrent),
            "SkipIfRunning" => Ok(Self::SkipIfRunning),
            other => Err(format!("invalid OverlapPolicy value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for OverlapPolicy {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for OverlapPolicy {
    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 RuntimeCompletionOutcome {
    #[default]
    #[serde(rename = "Completed")]
    Completed,
    #[serde(rename = "CallbackPending")]
    CallbackPending,
    #[serde(rename = "Cancelled")]
    Cancelled,
    #[serde(rename = "Abandoned")]
    Abandoned,
    #[serde(rename = "FinalizationFailed")]
    FinalizationFailed,
    #[serde(rename = "RuntimeTerminated")]
    RuntimeTerminated,
}
impl RuntimeCompletionOutcome {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Completed => "Completed",
            Self::CallbackPending => "CallbackPending",
            Self::Cancelled => "Cancelled",
            Self::Abandoned => "Abandoned",
            Self::FinalizationFailed => "FinalizationFailed",
            Self::RuntimeTerminated => "RuntimeTerminated",
        }
    }
}
impl std::convert::TryFrom<&str> for RuntimeCompletionOutcome {
    type Error = String;
    fn try_from(value: &str) -> Result<Self, Self::Error> {
        match value {
            "Completed" => Ok(Self::Completed),
            "CallbackPending" => Ok(Self::CallbackPending),
            "Cancelled" => Ok(Self::Cancelled),
            "Abandoned" => Ok(Self::Abandoned),
            "FinalizationFailed" => Ok(Self::FinalizationFailed),
            "RuntimeTerminated" => Ok(Self::RuntimeTerminated),
            other => Err(format!("invalid RuntimeCompletionOutcome value `{other}`")),
        }
    }
}
impl std::convert::TryFrom<String> for RuntimeCompletionOutcome {
    type Error = String;
    fn try_from(value: String) -> Result<Self, Self::Error> {
        Self::try_from(value.as_str())
    }
}
impl std::fmt::Display for RuntimeCompletionOutcome {
    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 RuntimeOutcomeKey(pub String);
impl From<String> for RuntimeOutcomeKey {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for RuntimeOutcomeKey {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for RuntimeOutcomeKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct ScheduleId(pub String);
impl From<String> for ScheduleId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for ScheduleId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for ScheduleId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct SessionId(pub String);
impl From<String> for SessionId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for SessionId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for SessionId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct TargetBindingId(pub String);
impl From<String> for TargetBindingId {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for TargetBindingId {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for TargetBindingId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}
#[derive(
    Debug,
    Clone,
    Default,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    serde::Serialize,
    serde::Deserialize,
)]
pub struct TriggerKey(pub String);
impl From<String> for TriggerKey {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl From<&str> for TriggerKey {
    fn from(value: &str) -> Self {
        Self(value.to_owned())
    }
}
impl std::fmt::Display for TriggerKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(&self.0)
    }
}

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 {
    Pending,
    Claimed,
    Dispatching,
    AwaitingCompletion,
    Completed,
    Skipped,
    Misfired,
    Superseded,
    DeliveryFailed,
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct State {
    pub phase: Phase,
    pub occurrence_id: OccurrenceId,
    pub schedule_id: ScheduleId,
    pub schedule_revision: u64,
    pub occurrence_ordinal: u64,
    pub trigger_key: TriggerKey,
    pub target_binding_key: TargetBindingId,
    pub misfire_policy: MisfirePolicy,
    pub misfire_policy_key: String,
    pub overlap_policy: OverlapPolicy,
    pub overlap_policy_key: String,
    pub missing_target_policy: MissingTargetPolicy,
    pub missing_target_policy_key: String,
    pub due_at_utc_ms: u64,
    pub misfire_deadline_utc_ms: u64,
    pub claimed_by: Option<ClaimOwner>,
    pub lease_expires_at_utc_ms: Option<u64>,
    pub claimed_at_utc_ms: Option<u64>,
    pub claim_token: Option<ClaimToken>,
    pub delivery_correlation_id: Option<CorrelationId>,
    pub target_materialized_session_id: Option<SessionId>,
    pub receipt_recorded_at_utc_ms: Option<u64>,
    pub last_receipt_recorded_at_utc_ms: Option<u64>,
    pub last_receipt_attempt: Option<u64>,
    pub last_receipt_stage: Option<DeliveryReceiptStage>,
    pub last_receipt_failure_class: Option<OccurrenceFailureClass>,
    pub last_receipt_detail: Option<String>,
    pub last_receipt_correlation_id: Option<CorrelationId>,
    pub last_receipt_materialized_session_id: Option<SessionId>,
    pub runtime_outcome_key: Option<RuntimeOutcomeKey>,
    pub receipt_stage: Option<DeliveryReceiptStage>,
    pub receipt_failure_class: Option<OccurrenceFailureClass>,
    pub receipt_detail: Option<String>,
    pub failure_class: Option<OccurrenceFailureClass>,
    pub failure_detail: Option<String>,
    pub dispatched_at_utc_ms: Option<u64>,
    pub completed_at_utc_ms: Option<u64>,
    pub attempt_count: u64,
    pub superseded_by_revision: Option<u64>,
    pub late_completion_recorded_at_utc_ms: Option<u64>,
    pub late_completion_resolution: Option<LateCompletionResolutionClass>,
    pub late_completion_detail: Option<String>,
    pub stale_completion_arrivals: u64,
}
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 PlanOccurrence {
        pub occurrence_id: OccurrenceId,
        pub schedule_id: ScheduleId,
        pub schedule_revision: u64,
        pub occurrence_ordinal: u64,
        pub trigger_key: TriggerKey,
        pub target_binding_key: TargetBindingId,
        pub misfire_policy: MisfirePolicy,
        pub misfire_policy_key: String,
        pub overlap_policy: OverlapPolicy,
        pub overlap_policy_key: String,
        pub missing_target_policy: MissingTargetPolicy,
        pub missing_target_policy_key: String,
        pub target_materialized_session_id: Option<SessionId>,
        pub due_at_utc_ms: u64,
        pub misfire_deadline_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct SyncTargetSnapshot {
        pub target_binding_key: TargetBindingId,
        pub target_materialized_session_id: Option<SessionId>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct RecordReceipt {
        pub correlation_id: Option<CorrelationId>,
        pub detail: Option<String>,
        pub materialized_session_id: Option<SessionId>,
        pub runtime_outcome_key: Option<RuntimeOutcomeKey>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyDue {
        pub now_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyOccurrenceTerminality {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyClaimedDispatchDisposition {
        pub schedule_phase: ClaimedDispatchSchedulePhase,
        pub current_schedule_revision: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyCompletionSupersession {
        pub schedule_phase: ClaimedDispatchSchedulePhase,
        pub current_schedule_revision: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Claim {
        pub owner_id: ClaimOwner,
        pub at_utc_ms: u64,
        pub lease_expires_at_utc_ms: u64,
        pub claim_token: ClaimToken,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DispatchStarted {
        pub correlation_id: Option<CorrelationId>,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AwaitCompletion {
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Complete {
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ResolveRuntimeCompletion {
        pub outcome: RuntimeCompletionOutcome,
        pub detail: Option<String>,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ResolveDeliveryCompletionFailure {
        pub reason: DeliveryCompletionFailureReason,
        pub detail: Option<String>,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ResolveDeliveryFailure {
        pub reason: DeliveryFailureReason,
        pub detail: Option<String>,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ResolveTargetProbe {
        pub outcome: OccurrenceTargetProbeOutcome,
        pub detail: Option<String>,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ResolveDueMisfire {
        pub detail: Option<String>,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Supersede {
        pub superseded_by_revision: u64,
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct LeaseExpired {
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ReleaseLeaseForPausedSchedule {
        pub at_utc_ms: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyTransitionFailure {
        pub refusal_kind: OccurrenceTransitionFailureRefusalKind,
        pub trigger: OccurrenceLifecycleInputVariant,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClassifyStaleCompletionArrival {
        pub trigger: OccurrenceLifecycleInputVariant,
    }
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Input {
    PlanOccurrence(inputs::PlanOccurrence),
    SyncTargetSnapshot(inputs::SyncTargetSnapshot),
    RecordReceipt(inputs::RecordReceipt),
    ClassifyDue(inputs::ClassifyDue),
    ClassifyOccurrenceTerminality(inputs::ClassifyOccurrenceTerminality),
    ClassifyClaimedDispatchDisposition(inputs::ClassifyClaimedDispatchDisposition),
    ClassifyCompletionSupersession(inputs::ClassifyCompletionSupersession),
    Claim(inputs::Claim),
    DispatchStarted(inputs::DispatchStarted),
    AwaitCompletion(inputs::AwaitCompletion),
    Complete(inputs::Complete),
    ResolveRuntimeCompletion(inputs::ResolveRuntimeCompletion),
    ResolveDeliveryCompletionFailure(inputs::ResolveDeliveryCompletionFailure),
    ResolveDeliveryFailure(inputs::ResolveDeliveryFailure),
    ResolveTargetProbe(inputs::ResolveTargetProbe),
    ResolveDueMisfire(inputs::ResolveDueMisfire),
    Supersede(inputs::Supersede),
    LeaseExpired(inputs::LeaseExpired),
    ReleaseLeaseForPausedSchedule(inputs::ReleaseLeaseForPausedSchedule),
    ClassifyTransitionFailure(inputs::ClassifyTransitionFailure),
    ClassifyStaleCompletionArrival(inputs::ClassifyStaleCompletionArrival),
}
impl Input {
    pub fn kind(&self) -> InputKind {
        match self {
            Self::PlanOccurrence(_) => InputKind::PlanOccurrence,
            Self::SyncTargetSnapshot(_) => InputKind::SyncTargetSnapshot,
            Self::RecordReceipt(_) => InputKind::RecordReceipt,
            Self::ClassifyDue(_) => InputKind::ClassifyDue,
            Self::ClassifyOccurrenceTerminality(_) => InputKind::ClassifyOccurrenceTerminality,
            Self::ClassifyClaimedDispatchDisposition(_) => {
                InputKind::ClassifyClaimedDispatchDisposition
            }
            Self::ClassifyCompletionSupersession(_) => InputKind::ClassifyCompletionSupersession,
            Self::Claim(_) => InputKind::Claim,
            Self::DispatchStarted(_) => InputKind::DispatchStarted,
            Self::AwaitCompletion(_) => InputKind::AwaitCompletion,
            Self::Complete(_) => InputKind::Complete,
            Self::ResolveRuntimeCompletion(_) => InputKind::ResolveRuntimeCompletion,
            Self::ResolveDeliveryCompletionFailure(_) => {
                InputKind::ResolveDeliveryCompletionFailure
            }
            Self::ResolveDeliveryFailure(_) => InputKind::ResolveDeliveryFailure,
            Self::ResolveTargetProbe(_) => InputKind::ResolveTargetProbe,
            Self::ResolveDueMisfire(_) => InputKind::ResolveDueMisfire,
            Self::Supersede(_) => InputKind::Supersede,
            Self::LeaseExpired(_) => InputKind::LeaseExpired,
            Self::ReleaseLeaseForPausedSchedule(_) => InputKind::ReleaseLeaseForPausedSchedule,
            Self::ClassifyTransitionFailure(_) => InputKind::ClassifyTransitionFailure,
            Self::ClassifyStaleCompletionArrival(_) => InputKind::ClassifyStaleCompletionArrival,
        }
    }
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum InputKind {
    PlanOccurrence,
    SyncTargetSnapshot,
    RecordReceipt,
    ClassifyDue,
    ClassifyOccurrenceTerminality,
    ClassifyClaimedDispatchDisposition,
    ClassifyCompletionSupersession,
    Claim,
    DispatchStarted,
    AwaitCompletion,
    Complete,
    ResolveRuntimeCompletion,
    ResolveDeliveryCompletionFailure,
    ResolveDeliveryFailure,
    ResolveTargetProbe,
    ResolveDueMisfire,
    Supersede,
    LeaseExpired,
    ReleaseLeaseForPausedSchedule,
    ClassifyTransitionFailure,
    ClassifyStaleCompletionArrival,
}

pub mod effects {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Claimed {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DispatchStarted {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct AwaitingCompletion {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Completed {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Skipped {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Misfired {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct Superseded {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct OccurrencesSuperseded {
        pub occurrence_id: OccurrenceId,
        pub superseding_revision: u64,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DueNoAction {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DueClaimEligible {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DueMisfireRequired {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DueLeaseExpired {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct OccurrenceTerminalityClassified {
        pub terminal: bool,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct ClaimedDispatchDispositionClassified {
        pub disposition: ClaimedDispatchDisposition,
        pub superseded_by_revision: Option<u64>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct CompletionSupersessionClassified {
        pub disposition: CompletionSupersessionDisposition,
        pub superseded_by_revision: Option<u64>,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct DeliveryFailed {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct LeaseExpired {}
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct TransitionFailureClassified {
        pub phase: OccurrenceLifecycleState,
        pub refusal_kind: OccurrenceTransitionFailureRefusalKind,
        pub trigger: OccurrenceLifecycleInputVariant,
        pub public_class: OccurrenceTransitionFailureClassKind,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct LateCompletionResolutionRecorded {
        pub resolution: LateCompletionResolutionClass,
    }
    #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
    pub struct StaleCompletionArrivalClassified {
        pub phase: OccurrenceLifecycleState,
        pub trigger: OccurrenceLifecycleInputVariant,
    }
}

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Effect {
    Claimed(effects::Claimed),
    DispatchStarted(effects::DispatchStarted),
    AwaitingCompletion(effects::AwaitingCompletion),
    Completed(effects::Completed),
    Skipped(effects::Skipped),
    Misfired(effects::Misfired),
    Superseded(effects::Superseded),
    OccurrencesSuperseded(effects::OccurrencesSuperseded),
    DueNoAction(effects::DueNoAction),
    DueClaimEligible(effects::DueClaimEligible),
    DueMisfireRequired(effects::DueMisfireRequired),
    DueLeaseExpired(effects::DueLeaseExpired),
    OccurrenceTerminalityClassified(effects::OccurrenceTerminalityClassified),
    ClaimedDispatchDispositionClassified(effects::ClaimedDispatchDispositionClassified),
    CompletionSupersessionClassified(effects::CompletionSupersessionClassified),
    DeliveryFailed(effects::DeliveryFailed),
    LeaseExpired(effects::LeaseExpired),
    TransitionFailureClassified(effects::TransitionFailureClassified),
    LateCompletionResolutionRecorded(effects::LateCompletionResolutionRecorded),
    StaleCompletionArrivalClassified(effects::StaleCompletionArrivalClassified),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum EffectKind {
    Claimed,
    DispatchStarted,
    AwaitingCompletion,
    Completed,
    Skipped,
    Misfired,
    Superseded,
    OccurrencesSuperseded,
    DueNoAction,
    DueClaimEligible,
    DueMisfireRequired,
    DueLeaseExpired,
    OccurrenceTerminalityClassified,
    ClaimedDispatchDispositionClassified,
    CompletionSupersessionClassified,
    DeliveryFailed,
    LeaseExpired,
    TransitionFailureClassified,
    LateCompletionResolutionRecorded,
    StaleCompletionArrivalClassified,
}

#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TransitionId {
    ClassifyTransitionFailurePlanRejectedPending,
    ClassifyTransitionFailurePlanRejectedClaimed,
    ClassifyTransitionFailurePlanRejectedDispatching,
    ClassifyTransitionFailurePlanRejectedAwaitingCompletion,
    ClassifyTransitionFailurePlanRejectedCompleted,
    ClassifyTransitionFailurePlanRejectedSkipped,
    ClassifyTransitionFailurePlanRejectedMisfired,
    ClassifyTransitionFailurePlanRejectedSuperseded,
    ClassifyTransitionFailurePlanRejectedDeliveryFailed,
    ClassifyTransitionFailureTargetSyncRejectedPending,
    ClassifyTransitionFailureTargetSyncRejectedClaimed,
    ClassifyTransitionFailureTargetSyncRejectedDispatching,
    ClassifyTransitionFailureTargetSyncRejectedAwaitingCompletion,
    ClassifyTransitionFailureTargetSyncRejectedCompleted,
    ClassifyTransitionFailureTargetSyncRejectedSkipped,
    ClassifyTransitionFailureTargetSyncRejectedMisfired,
    ClassifyTransitionFailureTargetSyncRejectedSuperseded,
    ClassifyTransitionFailureTargetSyncRejectedDeliveryFailed,
    ClassifyTransitionFailureReceiptRecordRejectedPending,
    ClassifyTransitionFailureReceiptRecordRejectedClaimed,
    ClassifyTransitionFailureReceiptRecordRejectedDispatching,
    ClassifyTransitionFailureReceiptRecordRejectedAwaitingCompletion,
    ClassifyTransitionFailureReceiptRecordRejectedCompleted,
    ClassifyTransitionFailureReceiptRecordRejectedSkipped,
    ClassifyTransitionFailureReceiptRecordRejectedMisfired,
    ClassifyTransitionFailureReceiptRecordRejectedSuperseded,
    ClassifyTransitionFailureReceiptRecordRejectedDeliveryFailed,
    ClassifyTransitionFailureDueClassificationRejectedPending,
    ClassifyTransitionFailureDueClassificationRejectedClaimed,
    ClassifyTransitionFailureDueClassificationRejectedDispatching,
    ClassifyTransitionFailureDueClassificationRejectedAwaitingCompletion,
    ClassifyTransitionFailureDueClassificationRejectedCompleted,
    ClassifyTransitionFailureDueClassificationRejectedSkipped,
    ClassifyTransitionFailureDueClassificationRejectedMisfired,
    ClassifyTransitionFailureDueClassificationRejectedSuperseded,
    ClassifyTransitionFailureDueClassificationRejectedDeliveryFailed,
    ClassifyTransitionFailureClaimedDispatchDispositionRejectedPending,
    ClassifyTransitionFailureClaimedDispatchDispositionRejectedClaimed,
    ClassifyTransitionFailureClaimedDispatchDispositionRejectedDispatching,
    ClassifyTransitionFailureClaimedDispatchDispositionRejectedAwaitingCompletion,
    ClassifyTransitionFailureClaimedDispatchDispositionRejectedCompleted,
    ClassifyTransitionFailureClaimedDispatchDispositionRejectedSkipped,
    ClassifyTransitionFailureClaimedDispatchDispositionRejectedMisfired,
    ClassifyTransitionFailureClaimedDispatchDispositionRejectedSuperseded,
    ClassifyTransitionFailureClaimedDispatchDispositionRejectedDeliveryFailed,
    ClassifyTransitionFailureCompletionSupersessionRejectedPending,
    ClassifyTransitionFailureCompletionSupersessionRejectedClaimed,
    ClassifyTransitionFailureCompletionSupersessionRejectedDispatching,
    ClassifyTransitionFailureCompletionSupersessionRejectedAwaitingCompletion,
    ClassifyTransitionFailureCompletionSupersessionRejectedCompleted,
    ClassifyTransitionFailureCompletionSupersessionRejectedSkipped,
    ClassifyTransitionFailureCompletionSupersessionRejectedMisfired,
    ClassifyTransitionFailureCompletionSupersessionRejectedSuperseded,
    ClassifyTransitionFailureCompletionSupersessionRejectedDeliveryFailed,
    ClassifyTransitionFailureClaimRejectedPendingPending,
    ClassifyTransitionFailureNotPendingForClaimClaimed,
    ClassifyTransitionFailureNotPendingForClaimDispatching,
    ClassifyTransitionFailureNotPendingForClaimAwaitingCompletion,
    ClassifyTransitionFailureNotPendingForClaimCompleted,
    ClassifyTransitionFailureNotPendingForClaimSkipped,
    ClassifyTransitionFailureNotPendingForClaimMisfired,
    ClassifyTransitionFailureNotPendingForClaimSuperseded,
    ClassifyTransitionFailureNotPendingForClaimDeliveryFailed,
    ClassifyTransitionFailureNotClaimedPending,
    ClassifyTransitionFailureNotClaimedClaimed,
    ClassifyTransitionFailureNotClaimedDispatching,
    ClassifyTransitionFailureNotClaimedAwaitingCompletion,
    ClassifyTransitionFailureNotClaimedCompleted,
    ClassifyTransitionFailureNotClaimedSkipped,
    ClassifyTransitionFailureNotClaimedMisfired,
    ClassifyTransitionFailureNotClaimedSuperseded,
    ClassifyTransitionFailureNotClaimedDeliveryFailed,
    ClassifyTransitionFailureNotDispatchingPending,
    ClassifyTransitionFailureNotDispatchingClaimed,
    ClassifyTransitionFailureNotDispatchingDispatching,
    ClassifyTransitionFailureNotDispatchingAwaitingCompletion,
    ClassifyTransitionFailureNotDispatchingCompleted,
    ClassifyTransitionFailureNotDispatchingSkipped,
    ClassifyTransitionFailureNotDispatchingMisfired,
    ClassifyTransitionFailureNotDispatchingSuperseded,
    ClassifyTransitionFailureNotDispatchingDeliveryFailed,
    ClassifyTransitionFailureNotLeaseHoldingPending,
    ClassifyTransitionFailureNotLeaseHoldingClaimed,
    ClassifyTransitionFailureNotLeaseHoldingDispatching,
    ClassifyTransitionFailureNotLeaseHoldingAwaitingCompletion,
    ClassifyTransitionFailureNotLeaseHoldingCompleted,
    ClassifyTransitionFailureNotLeaseHoldingSkipped,
    ClassifyTransitionFailureNotLeaseHoldingMisfired,
    ClassifyTransitionFailureNotLeaseHoldingSuperseded,
    ClassifyTransitionFailureNotLeaseHoldingDeliveryFailed,
    ClassifyTransitionFailureNotLiveForTerminalPending,
    ClassifyTransitionFailureNotLiveForTerminalClaimed,
    ClassifyTransitionFailureNotLiveForTerminalDispatching,
    ClassifyTransitionFailureNotLiveForTerminalAwaitingCompletion,
    ClassifyTransitionFailureNotLiveForTerminalCompleted,
    ClassifyTransitionFailureNotLiveForTerminalSkipped,
    ClassifyTransitionFailureNotLiveForTerminalMisfired,
    ClassifyTransitionFailureNotLiveForTerminalSuperseded,
    ClassifyTransitionFailureNotLiveForTerminalDeliveryFailed,
    ClassifyTransitionFailureStaleCompletionArrivalRejectedPending,
    ClassifyTransitionFailureStaleCompletionArrivalRejectedClaimed,
    ClassifyTransitionFailureStaleCompletionArrivalRejectedDispatching,
    ClassifyTransitionFailureStaleCompletionArrivalRejectedAwaitingCompletion,
    ClassifyTransitionFailureStaleCompletionArrivalRejectedCompleted,
    ClassifyTransitionFailureStaleCompletionArrivalRejectedSkipped,
    ClassifyTransitionFailureStaleCompletionArrivalRejectedMisfired,
    ClassifyTransitionFailureStaleCompletionArrivalRejectedSuperseded,
    ClassifyTransitionFailureStaleCompletionArrivalRejectedDeliveryFailed,
    ClassifyStaleCompletionArrivalObservedPending,
    ClassifyStaleCompletionArrivalObservedClaimed,
    ClassifyStaleCompletionArrivalObservedDispatching,
    ClassifyStaleCompletionArrivalObservedAwaitingCompletion,
    ClassifyStaleCompletionArrivalObservedCompleted,
    ClassifyStaleCompletionArrivalObservedSkipped,
    ClassifyStaleCompletionArrivalObservedMisfired,
    ClassifyStaleCompletionArrivalObservedSuperseded,
    ClassifyStaleCompletionArrivalObservedDeliveryFailed,
    PlanOccurrenceFromPending,
    ClassifyDuePendingFuture,
    ClassifyDuePendingMisfire,
    ClassifyDuePendingClaimEligible,
    ClassifyDueClaimedLeaseExpired,
    ClassifyDueDispatchingLeaseExpired,
    ClassifyDueAwaitingCompletionLeaseExpired,
    ClassifyDueClaimedLeaseCurrent,
    ClassifyDueDispatchingLeaseCurrent,
    ClassifyDueAwaitingCompletionLeaseCurrent,
    ClassifyDueCompletedNoAction,
    ClassifyDueSkippedNoAction,
    ClassifyDueMisfiredNoAction,
    ClassifyDueSupersededNoAction,
    ClassifyDueDeliveryFailedNoAction,
    ClassifyOccurrenceTerminalityTerminalCompleted,
    ClassifyOccurrenceTerminalityTerminalSkipped,
    ClassifyOccurrenceTerminalityTerminalMisfired,
    ClassifyOccurrenceTerminalityTerminalSuperseded,
    ClassifyOccurrenceTerminalityTerminalDeliveryFailed,
    ClassifyOccurrenceTerminalityLivePending,
    ClassifyOccurrenceTerminalityLiveClaimed,
    ClassifyOccurrenceTerminalityLiveDispatching,
    ClassifyOccurrenceTerminalityLiveAwaitingCompletion,
    ClassifyClaimedDispatchDispositionFutureRevision,
    ClassifyClaimedDispatchDispositionFrozen,
    ClassifyClaimedDispatchDispositionSupersedeDeleted,
    ClassifyClaimedDispatchDispositionSupersedeStale,
    ClassifyClaimedDispatchDispositionReady,
    ClassifyCompletionSupersessionDeleted,
    ClassifyCompletionSupersessionStale,
    ClassifyCompletionSupersessionProceed,
    ClassifyCompletionSupersessionAlreadySuperseded,
    SyncTargetSnapshotPending,
    SyncTargetSnapshotClaimed,
    RecordReceiptPending,
    RecordReceiptClaimed,
    RecordReceiptDispatching,
    RecordReceiptAwaitingCompletion,
    RecordReceiptCompleted,
    RecordReceiptSkipped,
    RecordReceiptMisfired,
    RecordReceiptSuperseded,
    RecordReceiptDeliveryFailed,
    ClaimPending,
    DispatchStartedFromClaimed,
    AwaitCompletionFromDispatching,
    AwaitCompletionAfterSupersession,
    CompleteFromDispatchingOrAwaiting,
    RuntimeCompletionCompleted,
    RuntimeCompletionRuntimeRejected,
    RuntimeCompletionTransportError,
    RuntimeCompletionInternalError,
    DeliveryCompletionFailureTransportError,
    DeliveryCompletionFailureInternalError,
    DeliveryFailureTargetMaterializationFailed,
    DeliveryFailureTargetMissing,
    DeliveryFailureTargetBusy,
    DeliveryFailureRuntimeRejected,
    DeliveryFailureMobRejected,
    DeliveryFailureTransportError,
    DeliveryFailureInternalError,
    TargetProbeReadyClaimed,
    TargetProbeBusyAllowedByPolicy,
    TargetProbeBusySkipByPolicy,
    TargetProbeMissingSkipByPolicy,
    TargetProbeMissingMisfireByPolicy,
    DueMisfirePending,
    SupersedePendingOrLive,
    SupersedeAlreadySuperseded,
    LateCompleteAfterSupersession,
    LateRuntimeCompletionCompletedAfterSupersession,
    LateRuntimeCompletionRejectedAfterSupersession,
    LateRuntimeCompletionTransportErrorAfterSupersession,
    LateRuntimeCompletionInternalErrorAfterSupersession,
    LateDeliveryCompletionFailureAfterSupersession,
    LateDeliveryFailureAfterSupersession,
    LeaseExpiredFromClaimed,
    LeaseExpiredFromDispatching,
    LeaseExpiredFromAwaitingCompletion,
    ReleaseLeaseForPausedScheduleFromClaimed,
    ReleaseLeaseForPausedScheduleFromDispatching,
    ReleaseLeaseForPausedScheduleFromAwaitingCompletion,
    ReleaseLeaseForPausedScheduleAfterSupersession,
}
#[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::Pending,
        occurrence_id: OccurrenceId("occurrence-0".to_string()),
        schedule_id: ScheduleId("schedule-0".to_string()),
        schedule_revision: 1,
        occurrence_ordinal: 0,
        trigger_key: TriggerKey("trigger-0".to_string()),
        target_binding_key: TargetBindingId("target-0".to_string()),
        misfire_policy: MisfirePolicy::Skip,
        misfire_policy_key: "misfire:skip".to_string(),
        overlap_policy: OverlapPolicy::SkipIfRunning,
        overlap_policy_key: "overlap:skip_if_running".to_string(),
        missing_target_policy: MissingTargetPolicy::MarkMisfired,
        missing_target_policy_key: "missing_target:mark_misfired".to_string(),
        due_at_utc_ms: 1,
        misfire_deadline_utc_ms: 1,
        claimed_by: None,
        lease_expires_at_utc_ms: None,
        claimed_at_utc_ms: None,
        claim_token: None,
        delivery_correlation_id: None,
        target_materialized_session_id: None,
        receipt_recorded_at_utc_ms: None,
        last_receipt_recorded_at_utc_ms: None,
        last_receipt_attempt: None,
        last_receipt_stage: None,
        last_receipt_failure_class: None,
        last_receipt_detail: None,
        last_receipt_correlation_id: None,
        last_receipt_materialized_session_id: None,
        runtime_outcome_key: None,
        receipt_stage: None,
        receipt_failure_class: None,
        receipt_detail: None,
        failure_class: None,
        failure_detail: None,
        dispatched_at_utc_ms: None,
        completed_at_utc_ms: None,
        attempt_count: 0,
        superseded_by_revision: None,
        late_completion_recorded_at_utc_ms: None,
        late_completion_resolution: None,
        late_completion_detail: None,
        stale_completion_arrivals: 0,
    }
}
