dpm_schedule/options.rs
1//! Opt-in adjustments to a remaining projection that callers request explicitly.
2
3use crate::ScheduleError;
4use serde::{Deserialize, Serialize};
5
6/// Adjustments a caller applies to one remaining projection; the default changes nothing.
7#[derive(Debug, Clone, Copy, Default, PartialEq, Serialize, Deserialize)]
8pub struct RemainingOptions {
9 /// Elapsed hours every task still awaiting verification waits for review after its work
10 /// ends, before the verifier's calendar is consulted. Zero reproduces the plain projection.
11 pub review_delay_hours: f64,
12}
13
14impl RemainingOptions {
15 /// Reject a review delay that is negative or not finite.
16 pub fn validate(self) -> Result<(), ScheduleError> {
17 if self.review_delay_hours.is_finite() && self.review_delay_hours >= 0.0 {
18 Ok(())
19 } else {
20 Err(ScheduleError::InvalidReviewDelay(self.review_delay_hours))
21 }
22 }
23
24 /// Whether the projection needs a review delay at all.
25 pub(crate) fn delays_review(self) -> bool {
26 self.review_delay_hours > 0.0
27 }
28}