50 lines
1.3 KiB
Rust
50 lines
1.3 KiB
Rust
use heromodels_core::BaseModelData;
|
|
use heromodels_derive::model;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Represents a step within a signing flow.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[model]
|
|
pub struct FlowStep {
|
|
/// Base model data.
|
|
pub base_data: BaseModelData,
|
|
|
|
/// Foreign key to the Flow this step belongs to.
|
|
#[index]
|
|
pub flow_id: u32,
|
|
|
|
/// Optional description for the step.
|
|
pub description: Option<String>,
|
|
|
|
/// Order of this step within the flow.
|
|
#[index]
|
|
pub step_order: u32,
|
|
|
|
/// Current status of the flow step (e.g., "Pending", "InProgress", "Completed", "Failed").
|
|
pub status: String,
|
|
}
|
|
|
|
impl FlowStep {
|
|
/// Create a new flow step.
|
|
pub fn new(id: u32, flow_id: u32, step_order: u32, status: impl ToString) -> Self {
|
|
Self {
|
|
base_data: BaseModelData::new(id),
|
|
flow_id,
|
|
description: None,
|
|
step_order,
|
|
status: status.to_string(),
|
|
}
|
|
}
|
|
|
|
/// Sets the description for the flow step.
|
|
pub fn description(mut self, description: impl ToString) -> Self {
|
|
self.description = Some(description.to_string());
|
|
self
|
|
}
|
|
|
|
// pub fn status(mut self, status: impl ToString) -> Self {
|
|
// self.status = status.to_string();
|
|
// self
|
|
// }
|
|
}
|