// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: provenance/marker/v1/accessgrant.proto

package types

import (
	fmt "fmt"
	_ "github.com/cosmos/cosmos-proto"
	_ "github.com/cosmos/gogoproto/gogoproto"
	proto "github.com/cosmos/gogoproto/proto"
	io "io"
	math "math"
	math_bits "math/bits"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package

// Access defines the different types of permissions that a marker supports granting to an address.
type Access int32

const (
	// ACCESS_UNSPECIFIED defines a no-op vote option.
	Access_Unknown Access = 0
	// ACCESS_MINT is the ability to increase the supply of a marker.
	Access_Mint Access = 1
	// ACCESS_BURN is the ability to decrease the supply of the marker using coin held by the marker.
	Access_Burn Access = 2
	// ACCESS_DEPOSIT is the ability to transfer funds from another account to this marker account
	// or to set a reference to this marker in the metadata/scopes module.
	Access_Deposit Access = 3
	// ACCESS_WITHDRAW is the ability to transfer funds from this marker account to another account
	// or to remove a reference to this marker in the metadata/scopes module.
	Access_Withdraw Access = 4
	// ACCESS_DELETE is the ability to move a proposed, finalized or active marker into the cancelled state.
	// This access also allows cancelled markers to be marked for deletion.
	Access_Delete Access = 5
	// ACCESS_ADMIN is the ability to add access grants for accounts to the list of marker permissions.
	// This access also gives the ability to update the marker's denom metadata.
	Access_Admin Access = 6
	// ACCESS_TRANSFER is the ability to manage transfer settings and broker transfers of the marker.
	// Accounts with this access can:
	//  - Update the marker's required attributes.
	//  - Update the send-deny list.
	//  - Use the transfer or bank send endpoints to move marker funds out of their own account.
	// This access right is only supported on RESTRICTED markers.
	Access_Transfer Access = 7
	// ACCESS_FORCE_TRANSFER is the ability to transfer restricted coins from a 3rd-party account without their signature.
	// This access right is only supported on RESTRICTED markers and only has meaning when allow_forced_transfer is true.
	Access_ForceTransfer Access = 8
)

var Access_name = map[int32]string{
	0: "ACCESS_UNSPECIFIED",
	1: "ACCESS_MINT",
	2: "ACCESS_BURN",
	3: "ACCESS_DEPOSIT",
	4: "ACCESS_WITHDRAW",
	5: "ACCESS_DELETE",
	6: "ACCESS_ADMIN",
	7: "ACCESS_TRANSFER",
	8: "ACCESS_FORCE_TRANSFER",
}

var Access_value = map[string]int32{
	"ACCESS_UNSPECIFIED":    0,
	"ACCESS_MINT":           1,
	"ACCESS_BURN":           2,
	"ACCESS_DEPOSIT":        3,
	"ACCESS_WITHDRAW":       4,
	"ACCESS_DELETE":         5,
	"ACCESS_ADMIN":          6,
	"ACCESS_TRANSFER":       7,
	"ACCESS_FORCE_TRANSFER": 8,
}

func (x Access) String() string {
	return proto.EnumName(Access_name, int32(x))
}

func (Access) EnumDescriptor() ([]byte, []int) {
	return fileDescriptor_7242c30a84644575, []int{0}
}

// AccessGrant associates a collection of permissions with an address for delegated marker account control.
type AccessGrant struct {
	Address     string     `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Permissions AccessList `protobuf:"varint,2,rep,packed,name=permissions,proto3,enum=provenance.marker.v1.Access,castrepeated=AccessList" json:"permissions,omitempty"`
}

func (m *AccessGrant) Reset()      { *m = AccessGrant{} }
func (*AccessGrant) ProtoMessage() {}
func (*AccessGrant) Descriptor() ([]byte, []int) {
	return fileDescriptor_7242c30a84644575, []int{0}
}
func (m *AccessGrant) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *AccessGrant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_AccessGrant.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalToSizedBuffer(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (m *AccessGrant) XXX_Merge(src proto.Message) {
	xxx_messageInfo_AccessGrant.Merge(m, src)
}
func (m *AccessGrant) XXX_Size() int {
	return m.Size()
}
func (m *AccessGrant) XXX_DiscardUnknown() {
	xxx_messageInfo_AccessGrant.DiscardUnknown(m)
}

var xxx_messageInfo_AccessGrant proto.InternalMessageInfo

func init() {
	proto.RegisterEnum("provenance.marker.v1.Access", Access_name, Access_value)
	proto.RegisterType((*AccessGrant)(nil), "provenance.marker.v1.AccessGrant")
}

func init() {
	proto.RegisterFile("provenance/marker/v1/accessgrant.proto", fileDescriptor_7242c30a84644575)
}

var fileDescriptor_7242c30a84644575 = []byte{
	// 499 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x31, 0x6f, 0xd3, 0x4c,
	0x18, 0xc7, 0xed, 0xb4, 0x4d, 0xd2, 0x4b, 0x9a, 0xd7, 0xef, 0xa9, 0x88, 0xd4, 0x14, 0xc7, 0x80,
	0x84, 0x2a, 0x44, 0x6d, 0xb5, 0x6c, 0x6c, 0x4e, 0xec, 0x80, 0xa5, 0xc6, 0x8d, 0x1c, 0x47, 0x91,
	0x58, 0x2a, 0xd7, 0x39, 0xd2, 0x53, 0xc9, 0x5d, 0x74, 0xe7, 0xa6, 0xf4, 0x1b, 0x20, 0x4f, 0x2c,
	0x48, 0x2c, 0x96, 0x32, 0x33, 0xf7, 0x43, 0x20, 0xa6, 0x8e, 0x6c, 0xa0, 0x64, 0xe1, 0x63, 0xa0,
	0xe4, 0x12, 0xe2, 0xa1, 0xdb, 0xf3, 0xdc, 0xff, 0x77, 0x3f, 0x3d, 0xba, 0x7b, 0xc0, 0xf3, 0x11,
	0xa3, 0x63, 0x44, 0x42, 0x12, 0x21, 0x73, 0x18, 0xb2, 0x4b, 0xc4, 0xcc, 0xf1, 0x91, 0x19, 0x46,
	0x11, 0xe2, 0x7c, 0xc0, 0x42, 0x12, 0x1b, 0x23, 0x46, 0x63, 0x0a, 0x77, 0xd7, 0x9c, 0x21, 0x38,
	0x63, 0x7c, 0xa4, 0xee, 0x0e, 0xe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x00, 0x00,
}

func (this *AccessGrant) Equal(that interface{}) bool {
	if that == nil {
		return this == nil
	}

	that1, ok := that.(*AccessGrant)
	if !ok {
		that2, ok := that.(AccessGrant)
		if ok {
			that1 = &that2
		} else {
			return false
		}
	}
	if that1 == nil {
		return this == nil
	} else if this == nil {
		return false
	}
	if this.Address != that1.Address {
		return false
	}
	if len(this.Permissions) != len(that1.Permissions) {
		return false
	}
	for i := range this.Permissions {
		if this.Permissions[i] != that1.Permissions[i] {
			return false
		}
	}
	return true
}
func (m *AccessGrant) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBuffer(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *AccessGrant) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *AccessGrant) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if len(m.Permissions) > 0 {
		dAtA2 := make([]byte, len(m.Permissions)*10)
		var j1 int
		for _, num := range m.Permissions {
			for num >= 1<<7 {
				dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80)
				num >>= 7
				j1++
			}
			dAtA2[j1] = uint8(num)
			j1++
		}
		i -= j1
		copy(dAtA[i:], dAtA2[:j1])
		i = encodeVarintAccessgrant(dAtA, i, uint64(j1))
		i--
		dAtA[i] = 0x12
	}
	if len(m.Address) > 0 {
		i -= len(m.Address)
		copy(dAtA[i:], m.Address)
		i = encodeVarintAccessgrant(dAtA, i, uint64(len(m.Address)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func encodeVarintAccessgrant(dAtA []byte, offset int, v uint64) int {
	offset -= sovAccessgrant(v)
	base := offset
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
	return base
}
func (m *AccessGrant) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.Address)
	if l > 0 {
		n += 1 + l + sovAccessgrant(uint64(l))
	}
	if len(m.Permissions) > 0 {
		l = 0
		for _, e := range m.Permissions {
			l += sovAccessgrant(uint64(e))
		}
		n += 1 + sovAccessgrant(uint64(l)) + l
	}
	return n
}

func sovAccessgrant(x uint64) (n int) {
	return (math_bits.Len64(x|1) + 6) / 7
}
func sozAccessgrant(x uint64) (n int) {
	return sovAccessgrant(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *AccessGrant) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowAccessgrant
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= uint64(b&0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: AccessGrant: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: AccessGrant: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowAccessgrant
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= uint64(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthAccessgrant
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return ErrInvalidLengthAccessgrant
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Address = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType == 0 {
				var v Access
				for shift := uint(0); ; shift += 7 {
					if shift >= 64 {
						return ErrIntOverflowAccessgrant
					}
					if iNdEx >= l {
						return io.ErrUnexpectedEOF
					}
					b := dAtA[iNdEx]
					iNdEx++
					v |= Access(b&0x7F) << shift
					if b < 0x80 {
						break
					}
				}
				m.Permissions = append(m.Permissions, v)
			} else if wireType == 2 {
				var packedLen int
				for shift := uint(0); ; shift += 7 {
					if shift >= 64 {
						return ErrIntOverflowAccessgrant
					}
					if iNdEx >= l {
						return io.ErrUnexpectedEOF
					}
					b := dAtA[iNdEx]
					iNdEx++
					packedLen |= int(b&0x7F) << shift
					if b < 0x80 {
						break
					}
				}
				if packedLen < 0 {
					return ErrInvalidLengthAccessgrant
				}
				postIndex := iNdEx + packedLen
				if postIndex < 0 {
					return ErrInvalidLengthAccessgrant
				}
				if postIndex > l {
					return io.ErrUnexpectedEOF
				}
				var elementCount int
				if elementCount != 0 && len(m.Permissions) == 0 {
					m.Permissions = make([]Access, 0, elementCount)
				}
				for iNdEx < postIndex {
					var v Access
					for shift := uint(0); ; shift += 7 {
						if shift >= 64 {
							return ErrIntOverflowAccessgrant
						}
						if iNdEx >= l {
							return io.ErrUnexpectedEOF
						}
						b := dAtA[iNdEx]
						iNdEx++
						v |= Access(b&0x7F) << shift
						if b < 0x80 {
							break
						}
					}
					m.Permissions = append(m.Permissions, v)
				}
			} else {
				return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType)
			}
		default:
			iNdEx = preIndex
			skippy, err := skipAccessgrant(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return ErrInvalidLengthAccessgrant
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func skipAccessgrant(dAtA []byte) (n int, err error) {
	l := len(dAtA)
	iNdEx := 0
	depth := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return 0, ErrIntOverflowAccessgrant
			}
			if iNdEx >= l {
				return 0, io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		wireType := int(wire & 0x7)
		switch wireType {
		case 0:
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowAccessgrant
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if dAtA[iNdEx-1] < 0x80 {
					break
				}
			}
		case 1:
			iNdEx += 8
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowAccessgrant
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if length < 0 {
				return 0, ErrInvalidLengthAccessgrant
			}
			iNdEx += length
		case 3:
			depth++
		case 4:
			if depth == 0 {
				return 0, ErrUnexpectedEndOfGroupAccessgrant
			}
			depth--
		case 5:
			iNdEx += 4
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
		if iNdEx < 0 {
			return 0, ErrInvalidLengthAccessgrant
		}
		if depth == 0 {
			return iNdEx, nil
		}
	}
	return 0, io.ErrUnexpectedEOF
}

var (
	ErrInvalidLengthAccessgrant        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAccessgrant          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAccessgrant = fmt.Errorf("proto: unexpected end of group")
)
