use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct Tracking {
pub shipments: Vec<Shipment>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Shipment {
pub id: String,
pub service: String,
pub origin: PointLocation,
pub destination: PointLocation,
pub status: ShipmentStatus,
pub details: ShipmentDetails,
pub events: Vec<ShipmentEvent>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PointLocation {
pub address: Address,
#[serde(rename = "servicePoint")]
pub service_point: Option<ServicePoint>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Address {
#[serde(rename = "addressLocality")]
pub address_locality: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ServicePoint {
pub url: String,
pub label: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ShipmentStatus {
pub timestamp: String,
pub location: PointLocation,
pub description: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ShipmentDetails {
#[serde(rename = "proofOfDelivery")]
pub proof_of_delivery: Option<ProofOfDelivery>,
#[serde(rename = "proofOfDeliverySignedAvailable")]
pub proof_of_delivery_signed_available: bool,
#[serde(rename = "totalNumberOfPieces")]
pub total_number_of_pieces: i32,
#[serde(rename = "pieceIds")]
pub piece_ids: Vec<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ProofOfDelivery {
#[serde(rename = "signatureUrl")]
pub signature_url: String,
#[serde(rename = "documentUrl")]
pub document_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ShipmentEvent {
pub timestamp: String,
pub location: PointLocation,
pub description: String,
}