use serde::{Deserialize, Serialize};
use serde_aux::field_attributes::deserialize_number_from_string;
#[derive(Serialize)]
pub struct RequestParameters {
#[serde(rename = "SC")]
pub sc: u32,
#[serde(rename = "DC")]
pub dc: u8,
#[serde(rename = "OF")]
pub of: u8,
#[serde(rename = "NAM")]
pub nam: Option<String>,
#[serde(rename = "NUM")]
pub num: Option<String>,
#[serde(rename = "TN")]
pub tn: Option<String>,
#[serde(rename = "OC")]
pub oc: Option<String>,
#[serde(rename = "DS")]
pub ds: Option<String>,
#[serde(rename = "DE")]
pub de: Option<String>,
#[serde(rename = "AFP")]
pub afp: Option<u8>,
#[serde(rename = "BS")]
pub bs: Option<u8>,
#[serde(rename = "REC")]
pub rec: Option<String>,
#[serde(rename = "TEC")]
pub tec: Option<String>,
#[serde(rename = "SK")]
pub sk: u8,
#[serde(rename = "MC")]
pub mc: u8,
}
impl RequestParameters {
pub fn new() -> RequestParameters {
RequestParameters {
sc: 0,
dc: 5,
of: 2,
nam: None,
num: None,
tn: None,
oc: None,
ds: None,
de: None,
afp: None,
bs: None,
rec: None,
tec: None,
sk: 1,
mc: 1,
}
}
pub fn set_sc<T: Into<u32>>(&mut self, sc: T) {
self.sc = sc.into();
}
pub fn set_dc<T: Into<u8>>(&mut self, dc: T) {
self.dc = dc.into();
}
pub fn set_nam<S: Into<String>>(&mut self, nam: S) {
self.nam = Option::from(nam.into());
}
pub fn set_num<S: Into<String>>(&mut self, num: S) {
self.num = Option::from(num.into());
}
pub fn set_tn<S: Into<String>>(&mut self, tn: S) {
self.tn = Option::from(tn.into());
}
pub fn set_oc<S: Into<String>>(&mut self, oc: S) {
self.oc = Option::from(oc.into());
}
pub fn set_ds<S: Into<String>>(&mut self, ds: S) {
self.ds = Option::from(ds.into());
}
pub fn set_de<S: Into<String>>(&mut self, de: S) {
self.de = Option::from(de.into());
}
pub fn set_afp<T: Into<u8>>(&mut self, afp: T) {
self.afp = Option::from(afp.into());
}
pub fn set_bs<T: Into<u8>>(&mut self, bs: T) {
self.bs = Option::from(bs.into());
}
pub fn set_rec<S: Into<String>>(&mut self, rec: S) {
self.rec = Option::from(rec.into());
}
pub fn set_tec<S: Into<String>>(&mut self, tec: S) {
self.tec = Option::from(tec.into());
}
pub fn set_sk<T: Into<u8>>(&mut self, sk: T) {
self.sk = sk.into();
}
}
#[derive(Deserialize)]
pub struct Response {
#[serde(rename = "gitekiInformation")]
pub giteki_information: GitekiInformation,
#[serde(rename = "giteki", skip_serializing_if = "Vec::is_empty", default)]
pub giteki: Vec<GitekiInfo>,
}
#[derive(Deserialize)]
pub struct GitekiInformation {
#[serde(rename = "lastUpdateDate")]
pub last_update_date: String,
#[serde(
rename = "totalCount",
deserialize_with = "deserialize_number_from_string"
)]
pub total_count: usize,
}
#[derive(Deserialize)]
pub struct GitekiInfo {
#[serde(deserialize_with = "deserialize_number_from_string")]
pub no: usize,
#[serde(rename = "techCode")]
pub tech_code: String,
pub number: String,
pub date: String,
pub name: String,
#[serde(rename = "radioEquipmentCode")]
pub radio_equipment_code: String,
#[serde(rename = "typeName")]
pub type_name: String,
#[serde(rename = "elecWave")]
pub elec_wave: String,
#[serde(rename = "spuriousRules")]
pub spurious_rules: String,
#[serde(rename = "bodySar")]
pub body_sar: String,
pub note: String,
#[serde(rename = "organName")]
pub organ_name: String,
#[serde(rename = "attachmentFileName")]
pub attachment_file_name: String,
#[serde(rename = "attachmentFileKey")]
pub attachment_file_key: String,
#[serde(rename = "attachmentFileCntForCd1")]
pub attachment_file_cnt_for_cd_1: String,
#[serde(rename = "attachmentFileCntForCd2")]
pub attachment_file_cnt_for_cd_2: String,
}