// This file is generated by rust-protobuf 3.7.2. Do not edit
// .proto file is parsed by protoc 24.4
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]

#![allow(unused_attributes)]
#![cfg_attr(rustfmt, rustfmt::skip)]

#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unused_results)]
#![allow(unused_mut)]

//! Generated file from `in_toto_attestation/v1/resource_descriptor.proto`

/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2;

// @@protoc_insertion_point(message:in_toto_attestation.v1.ResourceDescriptor)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct ResourceDescriptor {
    // message fields
    // @@protoc_insertion_point(field:in_toto_attestation.v1.ResourceDescriptor.name)
    pub name: ::std::string::String,
    // @@protoc_insertion_point(field:in_toto_attestation.v1.ResourceDescriptor.uri)
    pub uri: ::std::string::String,
    // @@protoc_insertion_point(field:in_toto_attestation.v1.ResourceDescriptor.digest)
    pub digest: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
    // @@protoc_insertion_point(field:in_toto_attestation.v1.ResourceDescriptor.content)
    pub content: ::std::vec::Vec<u8>,
    // @@protoc_insertion_point(field:in_toto_attestation.v1.ResourceDescriptor.download_location)
    pub download_location: ::std::string::String,
    // @@protoc_insertion_point(field:in_toto_attestation.v1.ResourceDescriptor.media_type)
    pub media_type: ::std::string::String,
    // @@protoc_insertion_point(field:in_toto_attestation.v1.ResourceDescriptor.annotations)
    pub annotations: ::protobuf::MessageField<::protobuf::well_known_types::struct_::Struct>,
    // special fields
    // @@protoc_insertion_point(special_field:in_toto_attestation.v1.ResourceDescriptor.special_fields)
    pub special_fields: ::protobuf::SpecialFields,
}

impl<'a> ::std::default::Default for &'a ResourceDescriptor {
    fn default() -> &'a ResourceDescriptor {
        <ResourceDescriptor as ::protobuf::Message>::default_instance()
    }
}

impl ResourceDescriptor {
    pub fn new() -> ResourceDescriptor {
        ::std::default::Default::default()
    }

    fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
        let mut fields = ::std::vec::Vec::with_capacity(7);
        let mut oneofs = ::std::vec::Vec::with_capacity(0);
        fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>(
            "name",
            |m: &ResourceDescriptor| { &m.name },
            |m: &mut ResourceDescriptor| { &mut m.name },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>(
            "uri",
            |m: &ResourceDescriptor| { &m.uri },
            |m: &mut ResourceDescriptor| { &mut m.uri },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor_new::<_, _>(
            "digest",
            |m: &ResourceDescriptor| { &m.digest },
            |m: &mut ResourceDescriptor| { &mut m.digest },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>(
            "content",
            |m: &ResourceDescriptor| { &m.content },
            |m: &mut ResourceDescriptor| { &mut m.content },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>(
            "download_location",
            |m: &ResourceDescriptor| { &m.download_location },
            |m: &mut ResourceDescriptor| { &mut m.download_location },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>(
            "media_type",
            |m: &ResourceDescriptor| { &m.media_type },
            |m: &mut ResourceDescriptor| { &mut m.media_type },
        ));
        fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, ::protobuf::well_known_types::struct_::Struct>(
            "annotations",
            |m: &ResourceDescriptor| { &m.annotations },
            |m: &mut ResourceDescriptor| { &mut m.annotations },
        ));
        ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<ResourceDescriptor>(
            "ResourceDescriptor",
            fields,
            oneofs,
        )
    }
}

impl ::protobuf::Message for ResourceDescriptor {
    const NAME: &'static str = "ResourceDescriptor";

    fn is_initialized(&self) -> bool {
        true
    }

    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
        while let Some(tag) = is.read_raw_tag_or_eof()? {
            match tag {
                10 => {
                    self.name = is.read_string()?;
                },
                18 => {
                    self.uri = is.read_string()?;
                },
                26 => {
                    let len = is.read_raw_varint32()?;
                    let old_limit = is.push_limit(len as u64)?;
                    let mut key = ::std::default::Default::default();
                    let mut value = ::std::default::Default::default();
                    while let Some(tag) = is.read_raw_tag_or_eof()? {
                        match tag {
                            10 => key = is.read_string()?,
                            18 => value = is.read_string()?,
                            _ => ::protobuf::rt::skip_field_for_tag(tag, is)?,
                        };
                    }
                    is.pop_limit(old_limit);
                    self.digest.insert(key, value);
                },
                34 => {
                    self.content = is.read_bytes()?;
                },
                42 => {
                    self.download_location = is.read_string()?;
                },
                50 => {
                    self.media_type = is.read_string()?;
                },
                58 => {
                    ::protobuf::rt::read_singular_message_into_field(is, &mut self.annotations)?;
                },
                tag => {
                    ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
                },
            };
        }
        ::std::result::Result::Ok(())
    }

    // Compute sizes of nested messages
    #[allow(unused_variables)]
    fn compute_size(&self) -> u64 {
        let mut my_size = 0;
        if !self.name.is_empty() {
            my_size += ::protobuf::rt::string_size(1, &self.name);
        }
        if !self.uri.is_empty() {
            my_size += ::protobuf::rt::string_size(2, &self.uri);
        }
        for (k, v) in &self.digest {
            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.content.is_empty() {
            my_size += ::protobuf::rt::bytes_size(4, &self.content);
        }
        if !self.download_location.is_empty() {
            my_size += ::protobuf::rt::string_size(5, &self.download_location);
        }
        if !self.media_type.is_empty() {
            my_size += ::protobuf::rt::string_size(6, &self.media_type);
        }
        if let Some(v) = self.annotations.as_ref() {
            let len = v.compute_size();
            my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
        }
        my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
        self.special_fields.cached_size().set(my_size as u32);
        my_size
    }

    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
        if !self.name.is_empty() {
            os.write_string(1, &self.name)?;
        }
        if !self.uri.is_empty() {
            os.write_string(2, &self.uri)?;
        }
        for (k, v) in &self.digest {
            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)?; // Tag.
            os.write_raw_varint32(entry_size as u32)?;
            os.write_string(1, &k)?;
            os.write_string(2, &v)?;
        };
        if !self.content.is_empty() {
            os.write_bytes(4, &self.content)?;
        }
        if !self.download_location.is_empty() {
            os.write_string(5, &self.download_location)?;
        }
        if !self.media_type.is_empty() {
            os.write_string(6, &self.media_type)?;
        }
        if let Some(v) = self.annotations.as_ref() {
            ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?;
        }
        os.write_unknown_fields(self.special_fields.unknown_fields())?;
        ::std::result::Result::Ok(())
    }

    fn special_fields(&self) -> &::protobuf::SpecialFields {
        &self.special_fields
    }

    fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
        &mut self.special_fields
    }

    fn new() -> ResourceDescriptor {
        ResourceDescriptor::new()
    }

    fn clear(&mut self) {
        self.name.clear();
        self.uri.clear();
        self.digest.clear();
        self.content.clear();
        self.download_location.clear();
        self.media_type.clear();
        self.annotations.clear();
        self.special_fields.clear();
    }

    fn default_instance() -> &'static ResourceDescriptor {
        static instance: ::protobuf::rt::Lazy<ResourceDescriptor> = ::protobuf::rt::Lazy::new();
        instance.get(ResourceDescriptor::new)
    }
}

impl ::protobuf::MessageFull for ResourceDescriptor {
    fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
        static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
        descriptor.get(|| file_descriptor().message_by_package_relative_name("ResourceDescriptor").unwrap()).clone()
    }
}

impl ::std::fmt::Display for ResourceDescriptor {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        ::protobuf::text_format::fmt(self, f)
    }
}

impl ::protobuf::reflect::ProtobufValue for ResourceDescriptor {
    type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}

static file_descriptor_proto_data: &'static [u8] = b"\
    \n0in_toto_attestation/v1/resource_descriptor.proto\x12\x16in_toto_attes\
    tation.v1\x1a\x1cgoogle/protobuf/struct.proto\"\xe6\x02\n\x12ResourceDes\
    criptor\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\x10\n\x03uri\
    \x18\x02\x20\x01(\tR\x03uri\x12N\n\x06digest\x18\x03\x20\x03(\x0b26.in_t\
    oto_attestation.v1.ResourceDescriptor.DigestEntryR\x06digest\x12\x18\n\
    \x07content\x18\x04\x20\x01(\x0cR\x07content\x12+\n\x11download_location\
    \x18\x05\x20\x01(\tR\x10downloadLocation\x12\x1d\n\nmedia_type\x18\x06\
    \x20\x01(\tR\tmediaType\x129\n\x0bannotations\x18\x07\x20\x01(\x0b2\x17.\
    google.protobuf.StructR\x0bannotations\x1a9\n\x0bDigestEntry\x12\x10\n\
    \x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\t\
    R\x05value:\x028\x01BG\n\x1fio.github.intoto.attestation.v1Z$github.com/\
    in-toto/attestation/go/v1b\x06proto3\
";

/// `FileDescriptorProto` object which was a source for this generated file
fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
    static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new();
    file_descriptor_proto_lazy.get(|| {
        ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
    })
}

/// `FileDescriptor` object which allows dynamic access to files
pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
    static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new();
    static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new();
    file_descriptor.get(|| {
        let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
            let mut deps = ::std::vec::Vec::with_capacity(1);
            deps.push(::protobuf::well_known_types::struct_::file_descriptor().clone());
            let mut messages = ::std::vec::Vec::with_capacity(1);
            messages.push(ResourceDescriptor::generated_message_descriptor_data());
            let mut enums = ::std::vec::Vec::with_capacity(0);
            ::protobuf::reflect::GeneratedFileDescriptor::new_generated(
                file_descriptor_proto(),
                deps,
                messages,
                enums,
            )
        });
        ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor)
    })
}
