use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ConnectorEnumType {
#[serde(rename_all = "UPPERCASE")]
Standard(StandardConnectorEnumType),
Custom(String),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum StandardConnectorEnumType {
#[serde(rename = "cCCS1")]
CCCS1,
#[serde(rename = "cCCS2")]
CCCS2,
#[serde(rename = "cChaoJi")]
CChaoJi,
#[serde(rename = "cG105")]
CG105,
#[serde(rename = "cGBT-DC")]
CGBTDC,
#[serde(rename = "cLECCS")]
CLECCS,
#[serde(rename = "cMCS")]
CMCS,
#[serde(rename = "cNACS")]
CNACS,
#[serde(rename = "cNACS-CCS1")]
CNACSCCS1,
#[serde(rename = "cCCS1-NACS")]
CCCS1NACS,
#[serde(rename = "cTesla")]
CTesla,
#[serde(rename = "cType1")]
CType1,
#[serde(rename = "cType2")]
CType2,
#[serde(rename = "cUltraChaoJi")]
CUltraChaoJi,
#[serde(rename = "s309-1P-16A")]
S3091P16A,
#[serde(rename = "s309-1P-32A")]
S3091P32A,
#[serde(rename = "s309-3P-16A")]
S3093P16A,
#[serde(rename = "s309-3P-32A")]
S3093P32A,
#[serde(rename = "sBS1361")]
SBS1361,
#[serde(rename = "sCEE-7-7")]
SCEE77,
#[serde(rename = "sType1")]
SType1,
#[serde(rename = "sType2")]
SType2,
#[serde(rename = "sType3")]
SType3,
#[serde(rename = "wInductive")]
WInductive,
#[serde(rename = "wResonant")]
WResonant,
#[serde(rename = "Other1PhMax16A")]
Other1PhMax16A,
#[serde(rename = "Other1PhOver16A")]
Other1PhOver16A,
#[serde(rename = "Other3Ph")]
Other3Ph,
#[serde(rename = "Pan")]
Pan,
#[serde(rename = "Undetermined")]
Undetermined,
#[serde(rename = "Unknown")]
Unknown,
}
impl ConnectorEnumType {
pub fn as_str(&self) -> &str {
match self {
Self::Standard(s) => match s {
StandardConnectorEnumType::CCCS1 => "cCCS1",
StandardConnectorEnumType::CCCS2 => "cCCS2",
StandardConnectorEnumType::CChaoJi => "cChaoJi",
StandardConnectorEnumType::CG105 => "cG105",
StandardConnectorEnumType::CGBTDC => "cGBT-DC",
StandardConnectorEnumType::CLECCS => "cLECCS",
StandardConnectorEnumType::CMCS => "cMCS",
StandardConnectorEnumType::CNACS => "cNACS",
StandardConnectorEnumType::CNACSCCS1 => "cNACS-CCS1",
StandardConnectorEnumType::CCCS1NACS => "cCCS1-NACS",
StandardConnectorEnumType::CTesla => "cTesla",
StandardConnectorEnumType::CType1 => "cType1",
StandardConnectorEnumType::CType2 => "cType2",
StandardConnectorEnumType::CUltraChaoJi => "cUltraChaoJi",
StandardConnectorEnumType::S3091P16A => "s309-1P-16A",
StandardConnectorEnumType::S3091P32A => "s309-1P-32A",
StandardConnectorEnumType::S3093P16A => "s309-3P-16A",
StandardConnectorEnumType::S3093P32A => "s309-3P-32A",
StandardConnectorEnumType::SBS1361 => "sBS1361",
StandardConnectorEnumType::SCEE77 => "sCEE-7-7",
StandardConnectorEnumType::SType1 => "sType1",
StandardConnectorEnumType::SType2 => "sType2",
StandardConnectorEnumType::SType3 => "sType3",
StandardConnectorEnumType::WInductive => "wInductive",
StandardConnectorEnumType::WResonant => "wResonant",
StandardConnectorEnumType::Other1PhMax16A => "Other1PhMax16A",
StandardConnectorEnumType::Other1PhOver16A => "Other1PhOver16A",
StandardConnectorEnumType::Other3Ph => "Other3Ph",
StandardConnectorEnumType::Pan => "Pan",
StandardConnectorEnumType::Undetermined => "Undetermined",
StandardConnectorEnumType::Unknown => "Unknown",
},
Self::Custom(s) => s,
}
}
}
impl From<String> for ConnectorEnumType {
fn from(s: String) -> Self {
match s.as_str() {
"cCCS1" => Self::Standard(StandardConnectorEnumType::CCCS1),
"cCCS2" => Self::Standard(StandardConnectorEnumType::CCCS2),
"cChaoJi" => Self::Standard(StandardConnectorEnumType::CChaoJi),
"cG105" => Self::Standard(StandardConnectorEnumType::CG105),
"cGBT-DC" => Self::Standard(StandardConnectorEnumType::CGBTDC),
"cLECCS" => Self::Standard(StandardConnectorEnumType::CLECCS),
"cMCS" => Self::Standard(StandardConnectorEnumType::CMCS),
"cNACS" => Self::Standard(StandardConnectorEnumType::CNACS),
"cNACS-CCS1" => Self::Standard(StandardConnectorEnumType::CNACSCCS1),
"cCCS1-NACS" => Self::Standard(StandardConnectorEnumType::CCCS1NACS),
"cTesla" => Self::Standard(StandardConnectorEnumType::CTesla),
"cType1" => Self::Standard(StandardConnectorEnumType::CType1),
"cType2" => Self::Standard(StandardConnectorEnumType::CType2),
"cUltraChaoJi" => Self::Standard(StandardConnectorEnumType::CUltraChaoJi),
"s309-1P-16A" => Self::Standard(StandardConnectorEnumType::S3091P16A),
"s309-1P-32A" => Self::Standard(StandardConnectorEnumType::S3091P32A),
"s309-3P-16A" => Self::Standard(StandardConnectorEnumType::S3093P16A),
"s309-3P-32A" => Self::Standard(StandardConnectorEnumType::S3093P32A),
"sBS1361" => Self::Standard(StandardConnectorEnumType::SBS1361),
"sCEE-7-7" => Self::Standard(StandardConnectorEnumType::SCEE77),
"sType1" => Self::Standard(StandardConnectorEnumType::SType1),
"sType2" => Self::Standard(StandardConnectorEnumType::SType2),
"sType3" => Self::Standard(StandardConnectorEnumType::SType3),
"wInductive" => Self::Standard(StandardConnectorEnumType::WInductive),
"wResonant" => Self::Standard(StandardConnectorEnumType::WResonant),
"Other1PhMax16A" => Self::Standard(StandardConnectorEnumType::Other1PhMax16A),
"Other1PhOver16A" => Self::Standard(StandardConnectorEnumType::Other1PhOver16A),
"Other3Ph" => Self::Standard(StandardConnectorEnumType::Other3Ph),
"Pan" => Self::Standard(StandardConnectorEnumType::Pan),
"Undetermined" => Self::Standard(StandardConnectorEnumType::Undetermined),
"Unknown" => Self::Standard(StandardConnectorEnumType::Unknown),
_ => Self::Custom(s),
}
}
}
impl ToString for ConnectorEnumType {
fn to_string(&self) -> String {
self.as_str().to_string()
}
}