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

package exchange

import (
	fmt "fmt"
	_ "github.com/cosmos/cosmos-proto"
	github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
	types "github.com/cosmos/cosmos-sdk/types"
	_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
	_ "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

// Payment represents one account's desire to trade funds with another account.
type Payment struct {
	// source is the account that created this Payment. It is considered the owner of the payment.
	Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
	// source_amount is the funds that the source is will pay the target in exchange for the target_amount.
	// A hold will be placed on this amount in the source account until this Payment is accepted, rejected or cancelled.
	// If the source_amount is zero, this Payment can be considered a "payment request."
	SourceAmount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=source_amount,json=sourceAmount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"source_amount"`
	// target is the account that can accept this Payment.
	// The target is the only thing allowed to change in a payment.
	// I.e. it can be empty initially and updated later as needed.
	Target string `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"`
	// target_amount is the funds that the target will pay the source in exchange for the source_amount.
	// If the target_amount is zero, this Payment can be considered a "peer-to-peer (P2P) payment."
	TargetAmount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=target_amount,json=targetAmount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"target_amount"`
	// external_id is used along with the source to uniquely identify this Payment.
	//
	// A source can only have one Payment with any given external id.
	// A source can have two payments with two different external ids.
	// Two different sources can each have a payment with the same external id.
	// But a source cannot have two different payments each with the same external id.
	//
	// An external id can be reused by a source once the payment is accepted, rejected, or cancelled.
	//
	// The external id is limited to 100 bytes. An empty string is a valid external id.
	ExternalId string `protobuf:"bytes,5,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"`
}

func (m *Payment) Reset()      { *m = Payment{} }
func (*Payment) ProtoMessage() {}
func (*Payment) Descriptor() ([]byte, []int) {
	return fileDescriptor_d21a428fd9374bb6, []int{0}
}
func (m *Payment) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *Payment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_Payment.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 *Payment) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Payment.Merge(m, src)
}
func (m *Payment) XXX_Size() int {
	return m.Size()
}
func (m *Payment) XXX_DiscardUnknown() {
	xxx_messageInfo_Payment.DiscardUnknown(m)
}

var xxx_messageInfo_Payment proto.InternalMessageInfo

func (m *Payment) GetSource() string {
	if m != nil {
		return m.Source
	}
	return ""
}

func (m *Payment) GetSourceAmount() github_com_cosmos_cosmos_sdk_types.Coins {
	if m != nil {
		return m.SourceAmount
	}
	return nil
}

func (m *Payment) GetTarget() string {
	if m != nil {
		return m.Target
	}
	return ""
}

func (m *Payment) GetTargetAmount() github_com_cosmos_cosmos_sdk_types.Coins {
	if m != nil {
		return m.TargetAmount
	}
	return nil
}

func (m *Payment) GetExternalId() string {
	if m != nil {
		return m.ExternalId
	}
	return ""
}

func init() {
	proto.RegisterType((*Payment)(nil), "provenance.exchange.v1.Payment")
}

func init() {
	proto.RegisterFile("provenance/exchange/v1/payments.proto", fileDescriptor_d21a428fd9374bb6)
}

var fileDescriptor_d21a428fd9374bb6 = []byte{
	// 398 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x92, 0xbf, 0x6b, 0x22, 0x41,
	0x14, 0xc7, 0x77, 0x4e, 0xcf, 0xe3, 0x56, 0xaf, 0x38, 0x91, 0x63, 0xb5, 0xd8, 0x95, 0x83, 0x80,
	0x08, 0xce, 0xc4, 0xa4, 0x4b, 0xa7, 0x81, 0x40, 0x3a, 0x31, 0x5d, 0x9a, 0x65, 0x76, 0x77, 0x58,
	0x87, 0xb8, 0x33, 0xcb, 0xce, 0x28, 0xfa, 0x0f, 0xa4, 0x4e, 0x19, 0x52, 0xa5, 0x0a, 0x21, 0x95,
	0x45, 0xfe, 0x08, 0x4b, 0x49, 0x95, 0x2a, 0x09, 0x5a, 0xf8, 0x6f, 0x84, 0xdd, 0x19, 0xa3, 0x45,
	0x20, 0x5d, 0x9a, 0x99, 0xf7, 0xe3, 0xfb, 0xde, 0xfb, 0x0c, 0xf3, 0xcc, 0xbd, 0x38, 0xe1, 0x63,
	0xc2, 0x30, 0xf3, 0x09, 0x22, 0x13, 0x7f, 0x80, 0x59, 0x48, 0xd0, 0xb8, 0x8d, 0x62, 0x3c, 0x8d,
	0x08, 0x93, 0x02, 0xc6, 0x09, 0x97, 0xbc, 0xfc, 0x6f, 0x2b, 0x83, 0x1b, 0x19, 0x1c, 0xb7, 0x6b,
	0x7f, 0x71, 0x44, 0x19, 0x47, 0xd9, 0xa9, 0xa4, 0x35, 0xdb, 0xe7, 0x22, 0xe2, 0x02, 0x79, 0x58,
	0xa4, 0x9d, 0x3c, 0x22, 0x71, 0x1b, 0xf9, 0x9c, 0x32, 0x9d, 0xaf, 0xaa, 0xbc, 0x9b, 0x79, 0x48,
	0x39, 0x3a, 0x55, 0x09, 0x79, 0xc8, 0x55, 0x3c, 0xb5, 0x54, 0xf4, 0xff, 0x5d, 0xce, 0xfc, 0xd5,
	0x53, 0x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f3, 0x93, 0x0d, 0xea, 0x81, 0x73, 0xb8,
	0xc3, 0xba, 0x15, 0xb5, 0x28, 0xdf, 0xf1, 0xd0, 0xe4, 0x63, 0x3b, 0xbd, 0x42, 0xb6, 0x16, 0x87,
	0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0x91, 0xa5, 0x2f, 0xe7, 0xbb, 0x02, 0x00, 0x00,
}

func (m *Payment) 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 *Payment) MarshalTo(dAtA []byte) (int, error) {
	size := m.Size()
	return m.MarshalToSizedBuffer(dAtA[:size])
}

func (m *Payment) MarshalToSizedBuffer(dAtA []byte) (int, error) {
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if len(m.ExternalId) > 0 {
		i -= len(m.ExternalId)
		copy(dAtA[i:], m.ExternalId)
		i = encodeVarintPayments(dAtA, i, uint64(len(m.ExternalId)))
		i--
		dAtA[i] = 0x2a
	}
	if len(m.TargetAmount) > 0 {
		for iNdEx := len(m.TargetAmount) - 1; iNdEx >= 0; iNdEx-- {
			{
				size, err := m.TargetAmount[iNdEx].MarshalToSizedBuffer(dAtA[:i])
				if err != nil {
					return 0, err
				}
				i -= size
				i = encodeVarintPayments(dAtA, i, uint64(size))
			}
			i--
			dAtA[i] = 0x22
		}
	}
	if len(m.Target) > 0 {
		i -= len(m.Target)
		copy(dAtA[i:], m.Target)
		i = encodeVarintPayments(dAtA, i, uint64(len(m.Target)))
		i--
		dAtA[i] = 0x1a
	}
	if len(m.SourceAmount) > 0 {
		for iNdEx := len(m.SourceAmount) - 1; iNdEx >= 0; iNdEx-- {
			{
				size, err := m.SourceAmount[iNdEx].MarshalToSizedBuffer(dAtA[:i])
				if err != nil {
					return 0, err
				}
				i -= size
				i = encodeVarintPayments(dAtA, i, uint64(size))
			}
			i--
			dAtA[i] = 0x12
		}
	}
	if len(m.Source) > 0 {
		i -= len(m.Source)
		copy(dAtA[i:], m.Source)
		i = encodeVarintPayments(dAtA, i, uint64(len(m.Source)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func encodeVarintPayments(dAtA []byte, offset int, v uint64) int {
	offset -= sovPayments(v)
	base := offset
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
	return base
}
func (m *Payment) Size() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.Source)
	if l > 0 {
		n += 1 + l + sovPayments(uint64(l))
	}
	if len(m.SourceAmount) > 0 {
		for _, e := range m.SourceAmount {
			l = e.Size()
			n += 1 + l + sovPayments(uint64(l))
		}
	}
	l = len(m.Target)
	if l > 0 {
		n += 1 + l + sovPayments(uint64(l))
	}
	if len(m.TargetAmount) > 0 {
		for _, e := range m.TargetAmount {
			l = e.Size()
			n += 1 + l + sovPayments(uint64(l))
		}
	}
	l = len(m.ExternalId)
	if l > 0 {
		n += 1 + l + sovPayments(uint64(l))
	}
	return n
}

func sovPayments(x uint64) (n int) {
	return (math_bits.Len64(x|1) + 6) / 7
}
func sozPayments(x uint64) (n int) {
	return sovPayments(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Payment) 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 ErrIntOverflowPayments
			}
			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: Payment: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: Payment: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowPayments
				}
				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 ErrInvalidLengthPayments
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return ErrInvalidLengthPayments
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Source = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field SourceAmount", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowPayments
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthPayments
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthPayments
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.SourceAmount = append(m.SourceAmount, types.Coin{})
			if err := m.SourceAmount[len(m.SourceAmount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowPayments
				}
				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 ErrInvalidLengthPayments
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return ErrInvalidLengthPayments
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Target = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field TargetAmount", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowPayments
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthPayments
			}
			postIndex := iNdEx + msglen
			if postIndex < 0 {
				return ErrInvalidLengthPayments
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.TargetAmount = append(m.TargetAmount, types.Coin{})
			if err := m.TargetAmount[len(m.TargetAmount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 5:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ExternalId", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowPayments
				}
				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 ErrInvalidLengthPayments
			}
			postIndex := iNdEx + intStringLen
			if postIndex < 0 {
				return ErrInvalidLengthPayments
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.ExternalId = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipPayments(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return ErrInvalidLengthPayments
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func skipPayments(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, ErrIntOverflowPayments
			}
			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, ErrIntOverflowPayments
				}
				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, ErrIntOverflowPayments
				}
				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, ErrInvalidLengthPayments
			}
			iNdEx += length
		case 3:
			depth++
		case 4:
			if depth == 0 {
				return 0, ErrUnexpectedEndOfGroupPayments
			}
			depth--
		case 5:
			iNdEx += 4
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
		if iNdEx < 0 {
			return 0, ErrInvalidLengthPayments
		}
		if depth == 0 {
			return iNdEx, nil
		}
	}
	return 0, io.ErrUnexpectedEOF
}

var (
	ErrInvalidLengthPayments        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowPayments          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupPayments = fmt.Errorf("proto: unexpected end of group")
)
