Skip to main content

workyard_application/contracts/
participant.rs

1use serde::Serialize;
2use trine::NativePath;
3use workyard_core::Participant;
4
5/// Participant placement and progress exposed to clients.
6#[derive(Serialize)]
7pub struct ParticipantOutcome {
8	/// Name used to identify this entry.
9	pub name: String,
10	/// Filesystem path associated with this entry.
11	pub path: NativePath,
12	/// Step reached by this participant.
13	pub phase: String,
14}
15
16impl From<Participant> for ParticipantOutcome {
17	fn from(participant: Participant) -> Self {
18		Self {
19			name: participant.name,
20			path: NativePath::new(participant.destination).expect("validated filesystem path"),
21			phase: participant.phase.as_str().into(),
22		}
23	}
24}
25
26#[derive(Serialize)]
27pub struct ParticipantChange {
28	pub participant: String,
29	pub kind: &'static str,
30}
31
32impl From<workyard_core::AmendmentChange> for ParticipantChange {
33	fn from(change: workyard_core::AmendmentChange) -> Self {
34		Self {
35			participant: change.participant,
36			kind: change.kind.as_str(),
37		}
38	}
39}