// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// InvokeWithMessagesRangeRequest represents TL type `invokeWithMessagesRange#365275f2`.
// Invoke with the given message range
//
// See https://core.telegram.org/constructor/invokeWithMessagesRange for reference.
type InvokeWithMessagesRangeRequest struct {
	// Message range
	Range MessageRange
	// Query
	Query bin.Object
}

// InvokeWithMessagesRangeRequestTypeID is TL type id of InvokeWithMessagesRangeRequest.
const InvokeWithMessagesRangeRequestTypeID = 0x365275f2

// Ensuring interfaces in compile-time for InvokeWithMessagesRangeRequest.
var (
	_ bin.Encoder     = &InvokeWithMessagesRangeRequest{}
	_ bin.Decoder     = &InvokeWithMessagesRangeRequest{}
	_ bin.BareEncoder = &InvokeWithMessagesRangeRequest{}
	_ bin.BareDecoder = &InvokeWithMessagesRangeRequest{}
)

func ( *InvokeWithMessagesRangeRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Range.Zero()) {
		return false
	}
	if !(.Query == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *InvokeWithMessagesRangeRequest) () string {
	if  == nil {
		return "InvokeWithMessagesRangeRequest(nil)"
	}
	type  InvokeWithMessagesRangeRequest
	return fmt.Sprintf("InvokeWithMessagesRangeRequest%+v", (*))
}

// FillFrom fills InvokeWithMessagesRangeRequest from given interface.
func ( *InvokeWithMessagesRangeRequest) ( interface {
	() ( MessageRange)
	() ( bin.Object)
}) {
	.Range = .()
	.Query = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InvokeWithMessagesRangeRequest) () uint32 {
	return InvokeWithMessagesRangeRequestTypeID
}

// TypeName returns name of type in TL schema.
func (*InvokeWithMessagesRangeRequest) () string {
	return "invokeWithMessagesRange"
}

// TypeInfo returns info about TL type.
func ( *InvokeWithMessagesRangeRequest) () tdp.Type {
	 := tdp.Type{
		Name: "invokeWithMessagesRange",
		ID:   InvokeWithMessagesRangeRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Range",
			SchemaName: "range",
		},
		{
			Name:       "Query",
			SchemaName: "query",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InvokeWithMessagesRangeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeWithMessagesRange#365275f2 as nil")
	}
	.PutID(InvokeWithMessagesRangeRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InvokeWithMessagesRangeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeWithMessagesRange#365275f2 as nil")
	}
	if  := .Range.Encode();  != nil {
		return fmt.Errorf("unable to encode invokeWithMessagesRange#365275f2: field range: %w", )
	}
	if  := .Query.Encode();  != nil {
		return fmt.Errorf("unable to encode invokeWithMessagesRange#365275f2: field query: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *InvokeWithMessagesRangeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode invokeWithMessagesRange#365275f2 to nil")
	}
	if  := .ConsumeID(InvokeWithMessagesRangeRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode invokeWithMessagesRange#365275f2: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *InvokeWithMessagesRangeRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode invokeWithMessagesRange#365275f2 to nil")
	}
	{
		if  := .Range.Decode();  != nil {
			return fmt.Errorf("unable to decode invokeWithMessagesRange#365275f2: field range: %w", )
		}
	}
	{
		if  := .Query.Decode();  != nil {
			return fmt.Errorf("unable to decode invokeWithMessagesRange#365275f2: field query: %w", )
		}
	}
	return nil
}

// GetRange returns value of Range field.
func ( *InvokeWithMessagesRangeRequest) () ( MessageRange) {
	if  == nil {
		return
	}
	return .Range
}

// GetQuery returns value of Query field.
func ( *InvokeWithMessagesRangeRequest) () ( bin.Object) {
	if  == nil {
		return
	}
	return .Query
}