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

// MessagesAffectedHistory represents TL type `messages.affectedHistory#b45c69d1`.
// Affected part of communication history with the user or in a chat.
//
// See https://core.telegram.org/constructor/messages.affectedHistory for reference.
type MessagesAffectedHistory struct {
	// Number of events occurred in a text box
	Pts int
	// Number of affected events
	PtsCount int
	// If a parameter contains positive value, it is necessary to repeat the method call
	// using the given value; during the proceeding of all the history the value itself shall
	// gradually decrease
	Offset int
}

// MessagesAffectedHistoryTypeID is TL type id of MessagesAffectedHistory.
const MessagesAffectedHistoryTypeID = 0xb45c69d1

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *MessagesAffectedHistory) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.affectedHistory#b45c69d1 as nil")
	}
	.PutID(MessagesAffectedHistoryTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesAffectedHistory) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.affectedHistory#b45c69d1 as nil")
	}
	.PutInt(.Pts)
	.PutInt(.PtsCount)
	.PutInt(.Offset)
	return nil
}

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

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

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

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

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