Spaces:
Running
Running
| use serde::Serialize; | |
| pub struct JobRoutesDto { | |
| pub id: String, | |
| pub job_id: String, | |
| pub snapshot_revision: u64, | |
| pub routes: Vec<TechnicianRouteGeometryDto>, | |
| } | |
| pub struct TechnicianRouteGeometryDto { | |
| pub route_id: String, | |
| pub technician_id: String, | |
| pub technician_name: String, | |
| pub color: String, | |
| pub segments: Vec<RouteSegmentDto>, | |
| } | |
| pub enum RouteGeometryStatus { | |
| Routed, | |
| UnreachableLeg, | |
| SnapFailed, | |
| NoPath, | |
| } | |
| pub struct RouteSegmentDto { | |
| pub route_id: String, | |
| pub from_location_idx: usize, | |
| pub to_location_idx: usize, | |
| pub duration_seconds: i64, | |
| pub distance_meters: i64, | |
| pub reachable: bool, | |
| pub geometry_status: RouteGeometryStatus, | |
| pub encoded_polyline: String, | |
| } | |
| impl JobRoutesDto { | |
| pub fn new( | |
| job_id: usize, | |
| snapshot_revision: u64, | |
| routes: Vec<TechnicianRouteGeometryDto>, | |
| ) -> Self { | |
| Self { | |
| id: job_id.to_string(), | |
| job_id: job_id.to_string(), | |
| snapshot_revision, | |
| routes, | |
| } | |
| } | |
| } | |