// 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{}
)

// InvokeAfterMsgsRequest represents TL type `invokeAfterMsgs#3dc4b4f0`.
// Invokes a query after a successful completion of previous queries
//
// See https://core.telegram.org/constructor/invokeAfterMsgs for reference.
type InvokeAfterMsgsRequest struct {
	// List of messages on which a current query depends
	MsgIDs []int64
	// The query itself
	Query bin.Object
}

// InvokeAfterMsgsRequestTypeID is TL type id of InvokeAfterMsgsRequest.
const InvokeAfterMsgsRequestTypeID = 0x3dc4b4f0

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

func ( *InvokeAfterMsgsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.MsgIDs == nil) {
		return false
	}
	if !(.Query == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InvokeAfterMsgsRequest from given interface.
func ( *InvokeAfterMsgsRequest) ( interface {
	() ( []int64)
	() ( bin.Object)
}) {
	.MsgIDs = .()
	.Query = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InvokeAfterMsgsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "invokeAfterMsgs",
		ID:   InvokeAfterMsgsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "MsgIDs",
			SchemaName: "msg_ids",
		},
		{
			Name:       "Query",
			SchemaName: "query",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InvokeAfterMsgsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeAfterMsgs#3dc4b4f0 as nil")
	}
	.PutID(InvokeAfterMsgsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InvokeAfterMsgsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeAfterMsgs#3dc4b4f0 as nil")
	}
	.PutVectorHeader(len(.MsgIDs))
	for ,  := range .MsgIDs {
		.PutLong()
	}
	if  := .Query.Encode();  != nil {
		return fmt.Errorf("unable to encode invokeAfterMsgs#3dc4b4f0: field query: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *InvokeAfterMsgsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode invokeAfterMsgs#3dc4b4f0 to nil")
	}
	if  := .ConsumeID(InvokeAfterMsgsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode invokeAfterMsgs#3dc4b4f0: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *InvokeAfterMsgsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode invokeAfterMsgs#3dc4b4f0 to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode invokeAfterMsgs#3dc4b4f0: field msg_ids: %w", )
		}

		if  > 0 {
			.MsgIDs = make([]int64, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Long()
			if  != nil {
				return fmt.Errorf("unable to decode invokeAfterMsgs#3dc4b4f0: field msg_ids: %w", )
			}
			.MsgIDs = append(.MsgIDs, )
		}
	}
	{
		if  := .Query.Decode();  != nil {
			return fmt.Errorf("unable to decode invokeAfterMsgs#3dc4b4f0: field query: %w", )
		}
	}
	return nil
}

// GetMsgIDs returns value of MsgIDs field.
func ( *InvokeAfterMsgsRequest) () ( []int64) {
	if  == nil {
		return
	}
	return .MsgIDs
}

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