use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Contract {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "factionSymbol")]
pub faction_symbol: String,
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "terms")]
pub terms: crate::models::ContractTerms,
#[serde(rename = "accepted")]
pub accepted: bool,
#[serde(rename = "fulfilled")]
pub fulfilled: bool,
#[serde(rename = "expiration")]
pub expiration: String,
#[serde(rename = "deadlineToAccept", skip_serializing_if = "Option::is_none")]
pub deadline_to_accept: Option<String>,
}
impl Contract {
#[allow(clippy::too_many_arguments)]
pub fn new(
id: String,
faction_symbol: String,
r#type: Type,
terms: crate::models::ContractTerms,
accepted: bool,
fulfilled: bool,
expiration: String,
) -> Contract {
Contract {
id,
faction_symbol,
r#type,
terms,
accepted,
fulfilled,
expiration,
deadline_to_accept: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "PROCUREMENT")]
Procurement,
#[serde(rename = "TRANSPORT")]
Transport,
#[serde(rename = "SHUTTLE")]
Shuttle,
}
impl Default for Type {
fn default() -> Type {
Self::Procurement
}
}