use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use super::{Bounds, Classification, Mutation, Outcome, Summary};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Submission {
pub verification: crate::jobs::Submission,
pub files: Vec<PathBuf>,
pub seed: u64,
pub bounds: Bounds,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Candidate {
pub mutation: Mutation,
pub function_hint: String,
pub description: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Exclusion {
pub file: PathBuf,
pub function_hint: Option<String>,
pub reason: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Plan {
pub version: u32,
pub source_sha256: String,
pub generator: String,
pub seed: u64,
pub bounds: Bounds,
pub files: Vec<PathBuf>,
pub candidates: Vec<Candidate>,
pub exclusions: Vec<Exclusion>,
pub omitted: u64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum State {
Planning,
Baseline,
Running,
Completed,
Partial,
Cancelled,
Superseded,
Interrupted,
InfrastructureError,
}
impl State {
#[must_use]
pub const fn terminal(self) -> bool {
!matches!(self, Self::Planning | Self::Baseline | Self::Running)
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Item {
pub candidate: Candidate,
pub outcome: Option<Outcome>,
pub attempts: u64,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct View {
pub kind: String,
pub version: u32,
pub id: String,
pub project_dir: PathBuf,
pub state: State,
pub currentness: crate::jobs::Currentness,
pub plan_sha256: String,
pub bounds: Bounds,
pub summary: Summary,
pub items: Vec<Item>,
pub submitted_at_ms: u64,
pub finished_at_ms: Option<u64>,
pub error: Option<crate::output::ErrorInfo>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Detail {
pub version: u32,
pub campaign_id: String,
pub evidence: Classification,
pub outcome: Outcome,
}