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

// InvokeAfterMsgRequest represents TL type `invokeAfterMsg#cb9f372d`.
// Invokes a query after successful completion of one of the previous queries.
//
// See https://core.telegram.org/constructor/invokeAfterMsg for reference.
type InvokeAfterMsgRequest struct {
	// Message identifier on which a current query depends
	MsgID int64
	// The query itself
	Query bin.Object
}

// InvokeAfterMsgRequestTypeID is TL type id of InvokeAfterMsgRequest.
const InvokeAfterMsgRequestTypeID = 0xcb9f372d

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

func ( *InvokeAfterMsgRequest) () bool {
	if  == nil {
		return true
	}
	if !(.MsgID == 0) {
		return false
	}
	if !(.Query == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InvokeAfterMsgRequest from given interface.
func ( *InvokeAfterMsgRequest) ( interface {
	() ( int64)
	() ( bin.Object)
}) {
	.MsgID = .()
	.Query = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InvokeAfterMsgRequest) () tdp.Type {
	 := tdp.Type{
		Name: "invokeAfterMsg",
		ID:   InvokeAfterMsgRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
		{
			Name:       "Query",
			SchemaName: "query",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InvokeAfterMsgRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeAfterMsg#cb9f372d as nil")
	}
	.PutID(InvokeAfterMsgRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InvokeAfterMsgRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode invokeAfterMsg#cb9f372d as nil")
	}
	.PutLong(.MsgID)
	if  := .Query.Encode();  != nil {
		return fmt.Errorf("unable to encode invokeAfterMsg#cb9f372d: field query: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InvokeAfterMsgRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode invokeAfterMsg#cb9f372d to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode invokeAfterMsg#cb9f372d: field msg_id: %w", )
		}
		.MsgID = 
	}
	{
		if  := .Query.Decode();  != nil {
			return fmt.Errorf("unable to decode invokeAfterMsg#cb9f372d: field query: %w", )
		}
	}
	return nil
}

// GetMsgID returns value of MsgID field.
func ( *InvokeAfterMsgRequest) () ( int64) {
	if  == nil {
		return
	}
	return .MsgID
}

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