Skip to content

Commit

Permalink
CostEntry with default
Browse files Browse the repository at this point in the history
  • Loading branch information
rruckley committed Nov 27, 2023
1 parent 35c2baa commit cfe27a7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/tmf7xx/cost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ use super::MOD_PATH;

const COST_PATH : &str = "cost";

/// Price structure
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CostEntry {
unit : String,
amount : f32,
}

impl Default for CostEntry {
fn default() -> Self {
CostEntry { unit: "Dollars".to_owned(), amount: 1.0 }
}
}

/// Cost Management
#[derive(Clone, Default, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
Expand All @@ -19,6 +33,8 @@ pub struct Cost {
pub name: Option<String>,
/// Validity
pub valid_for: Option<TimePeriod>,
/// Cost Value
pub cost : CostEntry,
}

impl Cost {
Expand Down

0 comments on commit cfe27a7

Please sign in to comment.