tp_lib_core/models/path_origin.rs
1//! Origin classification for train path segments
2
3use serde::{Deserialize, Serialize};
4
5/// Indicates whether a path segment was selected by the algorithm or manually added by a user.
6///
7/// When deserialising older path files that were produced before this field existed,
8/// the `#[default]` attribute ensures backward-compatibility: missing `origin` values
9/// are treated as [`PathOrigin::Algorithm`].
10///
11/// # Serialisation
12///
13/// The enum is serialised in lowercase: `"algorithm"` or `"manual"`.
14#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
15#[serde(rename_all = "lowercase")]
16pub enum PathOrigin {
17 /// Segment was selected by the path calculation algorithm.
18 /// This is the default, ensuring backward compatibility with older path files.
19 #[default]
20 Algorithm,
21
22 /// Segment was manually added by a user in the webapp review interface.
23 Manual,
24}