use crate::{CandidateId, ConstructionDependency, EvaluationCacheKey, ReplayHook, ReplayStatus};
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum DomainReplayTarget {
Hypersolve,
Hyperpath,
Hypercurve,
MeshOrCsg,
Hypervoxel,
Hyperpack,
Hyperdrc,
Hyperphysics,
Hypercircuit,
Other(String),
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DomainReplayManifest {
pub candidate: CandidateId,
pub target: DomainReplayTarget,
pub hook: ReplayHook,
pub dependencies: Vec<ConstructionDependency>,
pub cache_key: Option<EvaluationCacheKey>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DomainReplayReport {
pub manifest: DomainReplayManifest,
pub status: ReplayStatus,
pub evidence: Vec<String>,
}
impl DomainReplayReport {
pub fn is_accepted(&self) -> bool {
self.status == ReplayStatus::Accepted
}
pub fn needs_followup(&self) -> bool {
self.status == ReplayStatus::Unknown
}
}
pub fn domain_replay_manifest(
candidate: CandidateId,
target: DomainReplayTarget,
target_id: impl Into<String>,
) -> DomainReplayManifest {
let target_text = target_id.into();
let domain = match &target {
DomainReplayTarget::Hypersolve => "hypersolve",
DomainReplayTarget::Hyperpath => "hyperpath",
DomainReplayTarget::Hypercurve => "hypercurve",
DomainReplayTarget::MeshOrCsg => "mesh-or-csg",
DomainReplayTarget::Hypervoxel => "hypervoxel",
DomainReplayTarget::Hyperpack => "hyperpack",
DomainReplayTarget::Hyperdrc => "hyperdrc",
DomainReplayTarget::Hyperphysics => "hyperphysics",
DomainReplayTarget::Hypercircuit => "hypercircuit",
DomainReplayTarget::Other(name) => name.as_str(),
}
.to_string();
DomainReplayManifest {
candidate,
target,
hook: ReplayHook {
domain,
target: target_text.clone(),
},
dependencies: Vec::new(),
cache_key: Some(EvaluationCacheKey(format!("domain-replay:{target_text}"))),
}
}