// Copyright 2023-2025 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.36.11
// 	protoc        (unknown)
// source: buf/registry/policy/v1beta1/digest.proto

//go:build !protoopaque

package policyv1beta1

import (
	_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	reflect "reflect"
	unsafe "unsafe"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

// The type of Digest.
type DigestType int32

const (
	DigestType_DIGEST_TYPE_UNSPECIFIED DigestType = 0
	// The O1 digest function.
	DigestType_DIGEST_TYPE_O1 DigestType = 1
)

// Enum value maps for DigestType.
var (
	DigestType_name = map[int32]string{
		0: "DIGEST_TYPE_UNSPECIFIED",
		1: "DIGEST_TYPE_O1",
	}
	DigestType_value = map[string]int32{
		"DIGEST_TYPE_UNSPECIFIED": 0,
		"DIGEST_TYPE_O1":          1,
	}
)

func (x DigestType) Enum() *DigestType {
	p := new(DigestType)
	*p = x
	return p
}

func (x DigestType) String() string {
	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}

func (DigestType) Descriptor() protoreflect.EnumDescriptor {
	return file_buf_registry_policy_v1beta1_digest_proto_enumTypes[0].Descriptor()
}

func (DigestType) Type() protoreflect.EnumType {
	return &file_buf_registry_policy_v1beta1_digest_proto_enumTypes[0]
}

func (x DigestType) Number() protoreflect.EnumNumber {
	return protoreflect.EnumNumber(x)
}

// A digest of a Commit's content.
//
// A digest represents all content for a single Commit.
type Digest struct {
	state protoimpl.MessageState `protogen:"hybrid.v1"`
	// The type of the Digest.
	Type DigestType `protobuf:"varint,1,opt,name=type,proto3,enum=buf.registry.policy.v1beta1.DigestType" json:"type,omitempty"`
	// The value of the Digest.
	Value         []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Digest) Reset() {
	*x = Digest{}
	mi := &file_buf_registry_policy_v1beta1_digest_proto_msgTypes[0]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Digest) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Digest) ProtoMessage() {}

func (x *Digest) ProtoReflect() protoreflect.Message {
	mi := &file_buf_registry_policy_v1beta1_digest_proto_msgTypes[0]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

func (x *Digest) GetType() DigestType {
	if x != nil {
		return x.Type
	}
	return DigestType_DIGEST_TYPE_UNSPECIFIED
}

func (x *Digest) GetValue() []byte {
	if x != nil {
		return x.Value
	}
	return nil
}

func (x *Digest) SetType(v DigestType) {
	x.Type = v
}

func (x *Digest) SetValue(v []byte) {
	if v == nil {
		v = []byte{}
	}
	x.Value = v
}

type Digest_builder struct {
	_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.

	// The type of the Digest.
	Type DigestType
	// The value of the Digest.
	Value []byte
}

func (b0 Digest_builder) Build() *Digest {
	m0 := &Digest{}
	b, x := &b0, m0
	_, _ = b, x
	x.Type = b.Type
	x.Value = b.Value
	return m0
}

var File_buf_registry_policy_v1beta1_digest_proto protoreflect.FileDescriptor

const file_buf_registry_policy_v1beta1_digest_proto_rawDesc = "" +
	"\n" +
	"(buf/registry/policy/v1beta1/digest.proto\x12\x1bbuf.registry.policy.v1beta1\x1a\x1bbuf/validate/validate.proto\"p\n" +
	"\x06Digest\x12H\n" +
	"\x04type\x18\x01 \x01(\x0e2'.buf.registry.policy.v1beta1.DigestTypeB\v\xbaH\b\xc8\x01\x01\x82\x01\x02\x10\x01R\x04type\x12\x1c\n" +
	"\x05value\x18\x02 \x01(\fB\x06\xbaH\x03\xc8\x01\x01R\x05value*=\n" +
	"\n" +
	"DigestType\x12\x1b\n" +
	"\x17DIGEST_TYPE_UNSPECIFIED\x10\x00\x12\x12\n" +
	"\x0eDIGEST_TYPE_O1\x10\x01BaZ_buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/policy/v1beta1;policyv1beta1b\x06proto3"

var file_buf_registry_policy_v1beta1_digest_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_buf_registry_policy_v1beta1_digest_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_buf_registry_policy_v1beta1_digest_proto_goTypes = []any{
	(DigestType)(0), // 0: buf.registry.policy.v1beta1.DigestType
	(*Digest)(nil),  // 1: buf.registry.policy.v1beta1.Digest
}
var file_buf_registry_policy_v1beta1_digest_proto_depIdxs = []int32{
	0, // 0: buf.registry.policy.v1beta1.Digest.type:type_name -> buf.registry.policy.v1beta1.DigestType
	1, // [1:1] is the sub-list for method output_type
	1, // [1:1] is the sub-list for method input_type
	1, // [1:1] is the sub-list for extension type_name
	1, // [1:1] is the sub-list for extension extendee
	0, // [0:1] is the sub-list for field type_name
}

func init() { file_buf_registry_policy_v1beta1_digest_proto_init() }
func file_buf_registry_policy_v1beta1_digest_proto_init() {
	if File_buf_registry_policy_v1beta1_digest_proto != nil {
		return
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_buf_registry_policy_v1beta1_digest_proto_rawDesc), len(file_buf_registry_policy_v1beta1_digest_proto_rawDesc)),
			NumEnums:      1,
			NumMessages:   1,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_buf_registry_policy_v1beta1_digest_proto_goTypes,
		DependencyIndexes: file_buf_registry_policy_v1beta1_digest_proto_depIdxs,
		EnumInfos:         file_buf_registry_policy_v1beta1_digest_proto_enumTypes,
		MessageInfos:      file_buf_registry_policy_v1beta1_digest_proto_msgTypes,
	}.Build()
	File_buf_registry_policy_v1beta1_digest_proto = out.File
	file_buf_registry_policy_v1beta1_digest_proto_goTypes = nil
	file_buf_registry_policy_v1beta1_digest_proto_depIdxs = nil
}
