use serde::{Deserialize, Serialize};
use crate::types::{
AttrV, AttrVWithScheme, DocumentId, DocumentVersion, MarketParticipantId, MarketRoleType,
UtcDateTime,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AckReceivingDocType {
#[serde(rename = "A14")]
DayAheadPlan,
#[serde(rename = "A41")]
ActivationResponse,
#[serde(rename = "A42")]
TenderReduction,
#[serde(rename = "A60")]
StatusRequest,
#[serde(rename = "A67")]
PlannedUnavailability,
#[serde(rename = "A76")]
ForcedUnavailability,
#[serde(rename = "A80")]
ProductionUnavailability,
#[serde(rename = "A96")]
RedispatchActivation,
#[serde(rename = "B15")]
NetworkConstraint,
#[serde(rename = "Z01")]
StammdatenCreation,
#[serde(rename = "Z02")]
StammdatenUpdate,
#[serde(rename = "Z03")]
StammdatenDeactivation,
#[serde(rename = "Z04")]
StammdatenNbAggregate,
#[serde(rename = "Z05")]
Kostenblatt,
#[serde(rename = "Z08")]
IntradayPlan,
#[serde(rename = "Z09")]
StammdatenPlan,
#[serde(rename = "Z11")]
AggregatePlan,
#[serde(rename = "Z12")]
CorrectedPlan,
#[serde(rename = "Z13")]
Reserved13,
#[serde(rename = "Z14")]
Bilanzkreisstammdaten,
#[serde(rename = "Z15")]
StatusRequestAlt,
#[serde(rename = "Z16")]
Kaskade,
#[serde(rename = "Z17")]
TestMessage,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AckReasonCode {
#[serde(rename = "A01")]
FullyAccepted,
#[serde(rename = "A02")]
FullyRejected,
#[serde(rename = "Z12")]
SyntaxError,
#[serde(rename = "Z13")]
AssignmentError,
#[serde(rename = "Z14")]
DocumentIdNotUnique,
#[serde(rename = "Z15")]
SenderUnauthorised,
#[serde(rename = "Z16")]
NotPermitted,
#[serde(rename = "Z17")]
FormatVersionInvalid,
#[serde(rename = "Z18")]
ReportPeriodInvalid,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AckReason {
#[serde(rename = "ReasonCode")]
pub code: AttrV<AckReasonCode>,
#[serde(
rename = "ReasonText",
default,
skip_serializing_if = "Option::is_none"
)]
pub text: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TimeSeriesRejection {
#[serde(
rename = "TimeSeriesIdentification",
default,
skip_serializing_if = "Option::is_none"
)]
pub time_series_identification: Option<AttrV<DocumentId>>,
#[serde(rename = "Reason", default)]
pub reasons: Vec<AckReason>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename = "AcknowledgementDocument")]
pub struct AcknowledgementDocument {
#[serde(rename = "DocumentIdentification")]
pub document_identification: AttrV<DocumentId>,
#[serde(rename = "DocumentDateTime")]
pub document_date_time: AttrV<UtcDateTime>,
#[serde(rename = "SenderIdentification")]
pub sender_identification: AttrVWithScheme<MarketParticipantId>,
#[serde(rename = "SenderRole")]
pub sender_role: AttrV<MarketRoleType>,
#[serde(rename = "ReceiverIdentification")]
pub receiver_identification: AttrVWithScheme<MarketParticipantId>,
#[serde(rename = "ReceiverRole")]
pub receiver_role: AttrV<MarketRoleType>,
#[serde(
rename = "ReceivingDocumentIdentification",
default,
skip_serializing_if = "Option::is_none"
)]
pub receiving_document_identification: Option<AttrV<DocumentId>>,
#[serde(
rename = "ReceivingDocumentVersion",
default,
skip_serializing_if = "Option::is_none"
)]
pub receiving_document_version: Option<AttrV<DocumentVersion>>,
#[serde(
rename = "ReceivingDocumentType",
default,
skip_serializing_if = "Option::is_none"
)]
pub receiving_document_type: Option<AttrV<AckReceivingDocType>>,
#[serde(
rename = "ReceivingPayloadName",
default,
skip_serializing_if = "Option::is_none"
)]
pub receiving_payload_name: Option<AttrV<String>>,
#[serde(
rename = "DateTimeReceivingDocument",
default,
skip_serializing_if = "Option::is_none"
)]
pub date_time_receiving_document: Option<AttrV<UtcDateTime>>,
#[serde(
rename = "TimeSeriesRejection",
default,
skip_serializing_if = "Vec::is_empty"
)]
pub time_series_rejections: Vec<TimeSeriesRejection>,
#[serde(rename = "Reason")]
pub reasons: Vec<AckReason>,
}