use crate::{serial::request_message::RequestMessage, base::status::Status};
pub struct TransferdFileInfo {
    pub file_path: String,
    pub file_size: u64,
    pub key: String,
    pub file_url: String,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
#[derive(Clone, Copy, Debug)]
pub enum HTTPMethod {
    GET = 0,
    POST = 1,
}
pub struct ServiceInfo {
    pub dxc_name: String,
    pub dxc_version: String,
    pub service_name: String,
    pub md5: String,
    pub service_id: i64,
    pub online_time: i64,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct ConnIds {
    pub conn_id: Vec<i64>,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct DXCDSLInfo {
    pub md5: String,
    pub dsl: String,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct ChannelId {
    pub channel_id: Option<i64>,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct StringResponse {
    pub value: String,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct ChannelEvent {
    pub channel_ip: String,
    pub channel_id: i64,
    pub is_active: bool,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct LoadServiceRequest {
    pub dxc_name: String,
    pub dxc_version: String,
    pub service_name: String,
    pub only_build_ipc: bool,
    pub config: String,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct ServiceKey {
    pub dxc_name: String,
    pub dxc_version: String,
    pub service_name: String,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct GenIDResponse {
    pub id: i64,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct HttpRequest {
    pub method: Option<HTTPMethod>,
    pub url: String,
    pub headers: std::collections::HashMap<String, String>,
    pub body: String,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct ServiceInfos {
    pub service_infos: Vec<ServiceInfo>,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct DBExecuteResult {
    pub last_insert_id: u64,
    pub affected_rows: u64,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct HttpResponse {
    pub headers: std::collections::HashMap<String, String>,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct U64Response {
    pub value: u64,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct BoolResponse {
    pub is_exist: bool,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
pub struct UnloadServiceRequest {
    pub dxc_name: String,
    pub dxc_version: String,
    pub service_name: String,
    pub(crate) cached_size: protobuf::rt::CachedSize,
}
impl std::fmt::Debug for ChannelId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("ChannelId")
            .field("channel_id", &self.channel_id)
            .finish()
    }
}
impl Default for ChannelId {
    fn default() -> Self {
        ChannelId {
            channel_id: None,
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for ChannelId {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if let Some(v) = self.channel_id {
            my_size += protobuf::rt::int64_size(1, v);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if let Some(v) = self.channel_id {
            os.write_int64(1, v).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                8 => {
                    self.channel_id = Some(is.read_int64().unwrap());
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for GenIDResponse {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("GenIDResponse")
            .field("id", &self.id)
            .finish()
    }
}
impl Default for GenIDResponse {
    fn default() -> Self {
        GenIDResponse {
            id: 0,
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for GenIDResponse {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if self.id != 0 {
            my_size += protobuf::rt::int64_size(1, self.id);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if self.id != 0 {
            os.write_int64(1, self.id).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                8 => {
                    self.id = is.read_int64().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for ServiceInfo {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("ServiceInfo")
            .field("dxc_name", &self.dxc_name)
            .field("dxc_version", &self.dxc_version)
            .field("service_name", &self.service_name)
            .field("md5", &self.md5)
            .field("service_id", &self.service_id)
            .field("online_time", &self.online_time)
            .finish()
    }
}
impl Default for ServiceInfo {
    fn default() -> Self {
        ServiceInfo {
            dxc_name: String::default(),
            dxc_version: String::default(),
            service_name: String::default(),
            md5: String::default(),
            service_id: 0,
            online_time: 0,
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for ServiceInfo {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.dxc_name.is_empty() {
            my_size += protobuf::rt::string_size(1, &self.dxc_name);
        }
        if !self.dxc_version.is_empty() {
            my_size += protobuf::rt::string_size(2, &self.dxc_version);
        }
        if !self.service_name.is_empty() {
            my_size += protobuf::rt::string_size(3, &self.service_name);
        }
        if !self.md5.is_empty() {
            my_size += protobuf::rt::string_size(4, &self.md5);
        }
        if self.service_id != 0 {
            my_size += protobuf::rt::int64_size(5, self.service_id);
        }
        if self.online_time != 0 {
            my_size += protobuf::rt::int64_size(6, self.online_time);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if !self.dxc_name.is_empty() {
            os.write_string(1, &self.dxc_name).unwrap();
        }
        if !self.dxc_version.is_empty() {
            os.write_string(2, &self.dxc_version).unwrap();
        }
        if !self.service_name.is_empty() {
            os.write_string(3, &self.service_name).unwrap();
        }
        if !self.md5.is_empty() {
            os.write_string(4, &self.md5).unwrap();
        }
        if self.service_id != 0 {
            os.write_int64(5, self.service_id).unwrap();
        }
        if self.online_time != 0 {
            os.write_int64(6, self.online_time).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    self.dxc_name = is.read_string().unwrap();
                }
                18 => {
                    self.dxc_version = is.read_string().unwrap();
                }
                26 => {
                    self.service_name = is.read_string().unwrap();
                }
                34 => {
                    self.md5 = is.read_string().unwrap();
                }
                40 => {
                    self.service_id = is.read_int64().unwrap();
                }
                48 => {
                    self.online_time = is.read_int64().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for HttpRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("HttpRequest")
            .field("method", &self.method)
            .field("url", &self.url)
            .field("headers", &self.headers)
            .field("body", &self.body)
            .finish()
    }
}
impl Default for HttpRequest {
    fn default() -> Self {
        HttpRequest {
            method: HTTPMethod::from_i32(0),
            url: String::default(),
            headers: std::collections::HashMap::new(),
            body: String::default(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for HttpRequest {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if let Some(value) = self.method.as_ref() {
            my_size += protobuf::rt::int32_size(1, *value as i32);
        }
        if !self.url.is_empty() {
            my_size += protobuf::rt::string_size(2, &self.url);
        }
        for (k, v) in &self.headers {
            let mut entry_size = 0;
            entry_size += protobuf::rt::string_size(1, &k);
            entry_size += protobuf::rt::string_size(2, &v);
            my_size += 1 + protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size;
        }
        if !self.body.is_empty() {
            my_size += protobuf::rt::string_size(4, &self.body);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if let Some(value) = self.method.as_ref() {
            os.write_enum(1, *value as i32).unwrap();
        }
        if !self.url.is_empty() {
            os.write_string(2, &self.url).unwrap();
        }
        for (k, v) in &self.headers {
            let mut entry_size = 0;
            entry_size += protobuf::rt::string_size(1, &k);
            entry_size += protobuf::rt::string_size(2, &v);
            os.write_raw_varint32(26).unwrap();
            os.write_raw_varint32(entry_size as u32).unwrap();
            os.write_string(1, &k).unwrap();
            os.write_string(2, &v).unwrap();
        }
        if !self.body.is_empty() {
            os.write_string(4, &self.body).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                8 => {
                    let value = HTTPMethod::from_i32(is.read_int32().unwrap());
                    self.method = value;
                }
                18 => {
                    self.url = is.read_string().unwrap();
                }
                26 => {
                    let len = is.read_raw_varint32();
                    let len = len.unwrap();
                    let old_limit = is.push_limit(len as u64).unwrap();
                    let mut key = String::default();
                    let mut value = String::default();
                    while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
                        match tag {
                            10 => {
                                key = is.read_string().unwrap();
                            }
                            18 => {
                                value = is.read_string().unwrap();
                            }
                            _ => protobuf::rt::skip_field_for_tag(tag, is).unwrap(),
                        }
                    }
                    is.pop_limit(old_limit);
                    self.headers.insert(key, value);
                }
                34 => {
                    self.body = is.read_string().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for TransferdFileInfo {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("TransferdFileInfo")
            .field("file_path", &self.file_path)
            .field("file_size", &self.file_size)
            .field("key", &self.key)
            .field("file_url", &self.file_url)
            .finish()
    }
}
impl Default for TransferdFileInfo {
    fn default() -> Self {
        TransferdFileInfo {
            file_path: String::default(),
            file_size: 0,
            key: String::default(),
            file_url: String::default(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for TransferdFileInfo {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.file_path.is_empty() {
            my_size += protobuf::rt::string_size(1, &self.file_path);
        }
        if self.file_size != 0 {
            my_size += protobuf::rt::uint64_size(2, self.file_size);
        }
        if !self.key.is_empty() {
            my_size += protobuf::rt::string_size(3, &self.key);
        }
        if !self.file_url.is_empty() {
            my_size += protobuf::rt::string_size(4, &self.file_url);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if !self.file_path.is_empty() {
            os.write_string(1, &self.file_path).unwrap();
        }
        if self.file_size != 0 {
            os.write_uint64(2, self.file_size).unwrap();
        }
        if !self.key.is_empty() {
            os.write_string(3, &self.key).unwrap();
        }
        if !self.file_url.is_empty() {
            os.write_string(4, &self.file_url).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    self.file_path = is.read_string().unwrap();
                }
                16 => {
                    self.file_size = is.read_uint64().unwrap();
                }
                26 => {
                    self.key = is.read_string().unwrap();
                }
                34 => {
                    self.file_url = is.read_string().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for UnloadServiceRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("UnloadServiceRequest")
            .field("dxc_name", &self.dxc_name)
            .field("dxc_version", &self.dxc_version)
            .field("service_name", &self.service_name)
            .finish()
    }
}
impl Default for UnloadServiceRequest {
    fn default() -> Self {
        UnloadServiceRequest {
            dxc_name: String::default(),
            dxc_version: String::default(),
            service_name: String::default(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for UnloadServiceRequest {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.dxc_name.is_empty() {
            my_size += protobuf::rt::string_size(1, &self.dxc_name);
        }
        if !self.dxc_version.is_empty() {
            my_size += protobuf::rt::string_size(2, &self.dxc_version);
        }
        if !self.service_name.is_empty() {
            my_size += protobuf::rt::string_size(3, &self.service_name);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if !self.dxc_name.is_empty() {
            os.write_string(1, &self.dxc_name).unwrap();
        }
        if !self.dxc_version.is_empty() {
            os.write_string(2, &self.dxc_version).unwrap();
        }
        if !self.service_name.is_empty() {
            os.write_string(3, &self.service_name).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    self.dxc_name = is.read_string().unwrap();
                }
                18 => {
                    self.dxc_version = is.read_string().unwrap();
                }
                26 => {
                    self.service_name = is.read_string().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for ServiceInfos {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("ServiceInfos")
            .field("service_infos", &self.service_infos)
            .finish()
    }
}
impl Default for ServiceInfos {
    fn default() -> Self {
        ServiceInfos {
            service_infos: Vec::new(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for ServiceInfos {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        for value in &self.service_infos {
            let len = value.compute_size();
            my_size += 1 + protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        for v in &self.service_infos {
            os.write_tag(1, protobuf::rt::WireType::LengthDelimited)
                .unwrap();
            os.write_raw_varint32(v.cached_size.get() as u32).unwrap();
            v.serial_with_output_stream(os).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    let len = is.read_raw_varint64();
                    let len = len.unwrap();
                    let old_limit = is.push_limit(len);
                    let old_limit = old_limit.unwrap();
                    let mut value = ServiceInfo::default();
                    value.parse_from_input_stream(is)?;
                    self.service_infos.push(value);
                    is.pop_limit(old_limit);
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for LoadServiceRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("LoadServiceRequest")
            .field("dxc_name", &self.dxc_name)
            .field("dxc_version", &self.dxc_version)
            .field("service_name", &self.service_name)
            .field("only_build_ipc", &self.only_build_ipc)
            .field("config", &self.config)
            .finish()
    }
}
impl Default for LoadServiceRequest {
    fn default() -> Self {
        LoadServiceRequest {
            dxc_name: String::default(),
            dxc_version: String::default(),
            service_name: String::default(),
            only_build_ipc: false,
            config: String::default(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for LoadServiceRequest {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.dxc_name.is_empty() {
            my_size += protobuf::rt::string_size(1, &self.dxc_name);
        }
        if !self.dxc_version.is_empty() {
            my_size += protobuf::rt::string_size(2, &self.dxc_version);
        }
        if !self.service_name.is_empty() {
            my_size += protobuf::rt::string_size(3, &self.service_name);
        }
        if self.only_build_ipc != false {
            my_size += 2;
        }
        if !self.config.is_empty() {
            my_size += protobuf::rt::string_size(5, &self.config);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if !self.dxc_name.is_empty() {
            os.write_string(1, &self.dxc_name).unwrap();
        }
        if !self.dxc_version.is_empty() {
            os.write_string(2, &self.dxc_version).unwrap();
        }
        if !self.service_name.is_empty() {
            os.write_string(3, &self.service_name).unwrap();
        }
        if self.only_build_ipc != false {
            os.write_bool(4, self.only_build_ipc).unwrap();
        }
        if !self.config.is_empty() {
            os.write_string(5, &self.config).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    self.dxc_name = is.read_string().unwrap();
                }
                18 => {
                    self.dxc_version = is.read_string().unwrap();
                }
                26 => {
                    self.service_name = is.read_string().unwrap();
                }
                32 => {
                    self.only_build_ipc = is.read_bool().unwrap();
                }
                42 => {
                    self.config = is.read_string().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for DXCDSLInfo {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("DXCDSLInfo")
            .field("md5", &self.md5)
            .field("dsl", &self.dsl)
            .finish()
    }
}
impl Default for DXCDSLInfo {
    fn default() -> Self {
        DXCDSLInfo {
            md5: String::default(),
            dsl: String::default(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for DXCDSLInfo {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.md5.is_empty() {
            my_size += protobuf::rt::string_size(1, &self.md5);
        }
        if !self.dsl.is_empty() {
            my_size += protobuf::rt::string_size(2, &self.dsl);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if !self.md5.is_empty() {
            os.write_string(1, &self.md5).unwrap();
        }
        if !self.dsl.is_empty() {
            os.write_string(2, &self.dsl).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    self.md5 = is.read_string().unwrap();
                }
                18 => {
                    self.dsl = is.read_string().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for ConnIds {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("ConnIds")
            .field("conn_id", &self.conn_id)
            .finish()
    }
}
impl Default for ConnIds {
    fn default() -> Self {
        ConnIds {
            conn_id: Vec::new(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for ConnIds {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        for value in &self.conn_id {
            my_size += protobuf::rt::int64_size(1, *value);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        for v in &self.conn_id {
            os.write_int64(1, *v).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                8 => {
                    self.conn_id.push(is.read_int64().unwrap());
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for StringResponse {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("StringResponse")
            .field("value", &self.value)
            .finish()
    }
}
impl Default for StringResponse {
    fn default() -> Self {
        StringResponse {
            value: String::default(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for StringResponse {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.value.is_empty() {
            my_size += protobuf::rt::string_size(1, &self.value);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if !self.value.is_empty() {
            os.write_string(1, &self.value).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    self.value = is.read_string().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for U64Response {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("U64Response")
            .field("value", &self.value)
            .finish()
    }
}
impl Default for U64Response {
    fn default() -> Self {
        U64Response {
            value: 0,
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for U64Response {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if self.value != 0 {
            my_size += protobuf::rt::uint64_size(1, self.value);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if self.value != 0 {
            os.write_uint64(1, self.value).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                8 => {
                    self.value = is.read_uint64().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for ServiceKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("ServiceKey")
            .field("dxc_name", &self.dxc_name)
            .field("dxc_version", &self.dxc_version)
            .field("service_name", &self.service_name)
            .finish()
    }
}
impl Default for ServiceKey {
    fn default() -> Self {
        ServiceKey {
            dxc_name: String::default(),
            dxc_version: String::default(),
            service_name: String::default(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for ServiceKey {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.dxc_name.is_empty() {
            my_size += protobuf::rt::string_size(1, &self.dxc_name);
        }
        if !self.dxc_version.is_empty() {
            my_size += protobuf::rt::string_size(2, &self.dxc_version);
        }
        if !self.service_name.is_empty() {
            my_size += protobuf::rt::string_size(3, &self.service_name);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if !self.dxc_name.is_empty() {
            os.write_string(1, &self.dxc_name).unwrap();
        }
        if !self.dxc_version.is_empty() {
            os.write_string(2, &self.dxc_version).unwrap();
        }
        if !self.service_name.is_empty() {
            os.write_string(3, &self.service_name).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    self.dxc_name = is.read_string().unwrap();
                }
                18 => {
                    self.dxc_version = is.read_string().unwrap();
                }
                26 => {
                    self.service_name = is.read_string().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for BoolResponse {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("BoolResponse")
            .field("is_exist", &self.is_exist)
            .finish()
    }
}
impl Default for BoolResponse {
    fn default() -> Self {
        BoolResponse {
            is_exist: false,
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for BoolResponse {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if self.is_exist != false {
            my_size += 2;
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if self.is_exist != false {
            os.write_bool(1, self.is_exist).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                8 => {
                    self.is_exist = is.read_bool().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for HttpResponse {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("HttpResponse")
            .field("headers", &self.headers)
            .finish()
    }
}
impl Default for HttpResponse {
    fn default() -> Self {
        HttpResponse {
            headers: std::collections::HashMap::new(),
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for HttpResponse {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        for (k, v) in &self.headers {
            let mut entry_size = 0;
            entry_size += protobuf::rt::string_size(1, &k);
            entry_size += protobuf::rt::string_size(2, &v);
            my_size += 1 + protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size;
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        for (k, v) in &self.headers {
            let mut entry_size = 0;
            entry_size += protobuf::rt::string_size(1, &k);
            entry_size += protobuf::rt::string_size(2, &v);
            os.write_raw_varint32(10).unwrap();
            os.write_raw_varint32(entry_size as u32).unwrap();
            os.write_string(1, &k).unwrap();
            os.write_string(2, &v).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    let len = is.read_raw_varint32();
                    let len = len.unwrap();
                    let old_limit = is.push_limit(len as u64).unwrap();
                    let mut key = String::default();
                    let mut value = String::default();
                    while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
                        match tag {
                            10 => {
                                key = is.read_string().unwrap();
                            }
                            18 => {
                                value = is.read_string().unwrap();
                            }
                            _ => protobuf::rt::skip_field_for_tag(tag, is).unwrap(),
                        }
                    }
                    is.pop_limit(old_limit);
                    self.headers.insert(key, value);
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for DBExecuteResult {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("DBExecuteResult")
            .field("last_insert_id", &self.last_insert_id)
            .field("affected_rows", &self.affected_rows)
            .finish()
    }
}
impl Default for DBExecuteResult {
    fn default() -> Self {
        DBExecuteResult {
            last_insert_id: 0,
            affected_rows: 0,
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for DBExecuteResult {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if self.last_insert_id != 0 {
            my_size += protobuf::rt::uint64_size(1, self.last_insert_id);
        }
        if self.affected_rows != 0 {
            my_size += protobuf::rt::uint64_size(2, self.affected_rows);
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if self.last_insert_id != 0 {
            os.write_uint64(1, self.last_insert_id).unwrap();
        }
        if self.affected_rows != 0 {
            os.write_uint64(2, self.affected_rows).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                8 => {
                    self.last_insert_id = is.read_uint64().unwrap();
                }
                16 => {
                    self.affected_rows = is.read_uint64().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl std::fmt::Debug for ChannelEvent {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("ChannelEvent")
            .field("channel_ip", &self.channel_ip)
            .field("channel_id", &self.channel_id)
            .field("is_active", &self.is_active)
            .finish()
    }
}
impl Default for ChannelEvent {
    fn default() -> Self {
        ChannelEvent {
            channel_ip: String::default(),
            channel_id: 0,
            is_active: false,
            cached_size: protobuf::rt::CachedSize::new(),
        }
    }
}
impl RequestMessage for ChannelEvent {
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.channel_ip.is_empty() {
            my_size += protobuf::rt::string_size(1, &self.channel_ip);
        }
        if self.channel_id != 0 {
            my_size += protobuf::rt::int64_size(2, self.channel_id);
        }
        if self.is_active != false {
            my_size += 2;
        }
        self.cached_size.set(my_size as u32);
        my_size
    }
    fn serial_with_output_stream(
        &self,
        os: &mut protobuf::CodedOutputStream<'_>,
    ) -> Result<(), Status> {
        if !self.channel_ip.is_empty() {
            os.write_string(1, &self.channel_ip).unwrap();
        }
        if self.channel_id != 0 {
            os.write_int64(2, self.channel_id).unwrap();
        }
        if self.is_active != false {
            os.write_bool(3, self.is_active).unwrap();
        }
        Ok(())
    }
    fn parse_from_input_stream(
        &mut self,
        is: &mut protobuf::CodedInputStream<'_>,
    ) -> Result<(), Status> {
        while let Some(tag) = is.read_raw_tag_or_eof().unwrap() {
            match tag {
                10 => {
                    self.channel_ip = is.read_string().unwrap();
                }
                16 => {
                    self.channel_id = is.read_int64().unwrap();
                }
                24 => {
                    self.is_active = is.read_bool().unwrap();
                }
                _ => {}
            }
        }
        Ok(())
    }
}
impl HTTPMethod {
    fn from_i32(value: i32) -> Option<HTTPMethod> {
        match value {
            0 => Some(Self::GET),
            1 => Some(Self::POST),
            _ => None,
        }
    }
}