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

// MessagesAffectedMessages represents TL type `messages.affectedMessages#84d19185`.
// Events affected by operation
//
// See https://core.telegram.org/constructor/messages.affectedMessages for reference.
type MessagesAffectedMessages 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
}

// MessagesAffectedMessagesTypeID is TL type id of MessagesAffectedMessages.
const MessagesAffectedMessagesTypeID = 0x84d19185

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

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

	return true
}

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

// FillFrom fills MessagesAffectedMessages from given interface.
func ( *MessagesAffectedMessages) ( interface {
	() ( int)
	() ( int)
}) {
	.Pts = .()
	.PtsCount = .()
}

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesAffectedMessages) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.affectedMessages#84d19185 as nil")
	}
	.PutID(MessagesAffectedMessagesTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesAffectedMessages) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.affectedMessages#84d19185 as nil")
	}
	.PutInt(.Pts)
	.PutInt(.PtsCount)
	return nil
}

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

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

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

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