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

// MessagesAffectedFoundMessages represents TL type `messages.affectedFoundMessages#ef8d3e6c`.
// Messages found and affected by changes
//
// See https://core.telegram.org/constructor/messages.affectedFoundMessages for reference.
type MessagesAffectedFoundMessages struct {
	// Event count after generation¹
	//
	// Links:
	//  1) https://core.telegram.org/api/updates
	Pts int
	// Number of events that were generated¹
	//
	// Links:
	//  1) https://core.telegram.org/api/updates
	PtsCount int
	// If bigger than zero, the request must be repeated to remove more messages
	Offset int
	// Affected message IDs
	Messages []int
}

// MessagesAffectedFoundMessagesTypeID is TL type id of MessagesAffectedFoundMessages.
const MessagesAffectedFoundMessagesTypeID = 0xef8d3e6c

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

func ( *MessagesAffectedFoundMessages) () bool {
	if  == nil {
		return true
	}
	if !(.Pts == 0) {
		return false
	}
	if !(.PtsCount == 0) {
		return false
	}
	if !(.Offset == 0) {
		return false
	}
	if !(.Messages == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesAffectedFoundMessages from given interface.
func ( *MessagesAffectedFoundMessages) ( interface {
	() ( int)
	() ( int)
	() ( int)
	() ( []int)
}) {
	.Pts = .()
	.PtsCount = .()
	.Offset = .()
	.Messages = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesAffectedFoundMessages) () string {
	return "messages.affectedFoundMessages"
}

// TypeInfo returns info about TL type.
func ( *MessagesAffectedFoundMessages) () tdp.Type {
	 := tdp.Type{
		Name: "messages.affectedFoundMessages",
		ID:   MessagesAffectedFoundMessagesTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Pts",
			SchemaName: "pts",
		},
		{
			Name:       "PtsCount",
			SchemaName: "pts_count",
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
		{
			Name:       "Messages",
			SchemaName: "messages",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesAffectedFoundMessages) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.affectedFoundMessages#ef8d3e6c as nil")
	}
	.PutID(MessagesAffectedFoundMessagesTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesAffectedFoundMessages) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.affectedFoundMessages#ef8d3e6c as nil")
	}
	.PutInt(.Pts)
	.PutInt(.PtsCount)
	.PutInt(.Offset)
	.PutVectorHeader(len(.Messages))
	for ,  := range .Messages {
		.PutInt()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesAffectedFoundMessages) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.affectedFoundMessages#ef8d3e6c to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.affectedFoundMessages#ef8d3e6c: field pts: %w", )
		}
		.Pts = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.affectedFoundMessages#ef8d3e6c: field pts_count: %w", )
		}
		.PtsCount = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messages.affectedFoundMessages#ef8d3e6c: field offset: %w", )
		}
		.Offset = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode messages.affectedFoundMessages#ef8d3e6c: field messages: %w", )
		}

		if  > 0 {
			.Messages = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode messages.affectedFoundMessages#ef8d3e6c: field messages: %w", )
			}
			.Messages = append(.Messages, )
		}
	}
	return nil
}

// GetPts returns value of Pts field.
func ( *MessagesAffectedFoundMessages) () ( int) {
	if  == nil {
		return
	}
	return .Pts
}

// GetPtsCount returns value of PtsCount field.
func ( *MessagesAffectedFoundMessages) () ( int) {
	if  == nil {
		return
	}
	return .PtsCount
}

// GetOffset returns value of Offset field.
func ( *MessagesAffectedFoundMessages) () ( int) {
	if  == nil {
		return
	}
	return .Offset
}

// GetMessages returns value of Messages field.
func ( *MessagesAffectedFoundMessages) () ( []int) {
	if  == nil {
		return
	}
	return .Messages
}