use serde::Serialize;
use solverforge::{HardSoftScore, SolverStatus};
use crate::api::dto::{JobSnapshotDto, JobSummaryDto};
#[derive(Debug, Clone, Serialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase")]
pub struct SolveResultDto {
#[serde(flatten)]
pub status: JobSummaryDto,
pub snapshot: Option<JobSnapshotDto>,
pub snapshot_error: Option<String>,
}
impl SolveResultDto {
pub fn from_status(job_id: usize, status: &SolverStatus<HardSoftScore>) -> Self {
Self {
status: JobSummaryDto::from_status(job_id, status),
snapshot: None,
snapshot_error: None,
}
}
}