use super::{
AgreementAuthorization, AgreementItem, AgreementRelationship, AgreementSpecificationRef,
Characteristic, PartyRefOrPartyRoleRef, RelatedDocumentRefOrValue,
RelatedPartyRefOrPartyRoleRef,
};
use crate::common::entity::Entity;
use crate::TimePeriod;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Agreement {
#[serde(flatten)]
pub entity: Entity,
#[serde(rename = "agreementAuthorization")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub agreement_authorization: Vec<AgreementAuthorization>,
#[serde(rename = "agreementItem")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub agreement_item: Vec<AgreementItem>,
#[serde(rename = "agreementPeriod")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub agreement_period: Option<TimePeriod>,
#[serde(rename = "agreementRelationship")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub agreement_relationship: Vec<AgreementRelationship>,
#[serde(rename = "agreementSpecification")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub agreement_specification: Option<AgreementSpecificationRef>,
#[serde(rename = "agreementType")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub agreement_type: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub characteristic: Vec<Characteristic>,
#[serde(rename = "completionDate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub completion_date: Option<TimePeriod>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "engagedParty")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub engaged_party: Vec<PartyRefOrPartyRoleRef>,
#[serde(rename = "initialDate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub initial_date: Option<crate::DateTime>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "relatedDocument")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_document: Vec<RelatedDocumentRefOrValue>,
#[serde(rename = "relatedParty")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub related_party: Vec<RelatedPartyRefOrPartyRoleRef>,
#[serde(rename = "statementOfIntent")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub statement_of_intent: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
}
impl std::fmt::Display for Agreement {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}
impl std::ops::Deref for Agreement {
type Target = Entity;
fn deref(&self) -> &Self::Target {
&self.entity
}
}
impl std::ops::DerefMut for Agreement {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.entity
}
}