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

// MessageRange represents TL type `messageRange#ae30253`.
// Indicates a range of chat messages
//
// See https://core.telegram.org/constructor/messageRange for reference.
type MessageRange struct {
	// Start of range (message ID)
	MinID int
	// End of range (message ID)
	MaxID int
}

// MessageRangeTypeID is TL type id of MessageRange.
const MessageRangeTypeID = 0xae30253

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

func ( *MessageRange) () bool {
	if  == nil {
		return true
	}
	if !(.MinID == 0) {
		return false
	}
	if !(.MaxID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessageRange from given interface.
func ( *MessageRange) ( interface {
	() ( int)
	() ( int)
}) {
	.MinID = .()
	.MaxID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessageRange) () tdp.Type {
	 := tdp.Type{
		Name: "messageRange",
		ID:   MessageRangeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "MinID",
			SchemaName: "min_id",
		},
		{
			Name:       "MaxID",
			SchemaName: "max_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessageRange) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageRange#ae30253 as nil")
	}
	.PutID(MessageRangeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessageRange) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messageRange#ae30253 as nil")
	}
	.PutInt(.MinID)
	.PutInt(.MaxID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessageRange) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messageRange#ae30253 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageRange#ae30253: field min_id: %w", )
		}
		.MinID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode messageRange#ae30253: field max_id: %w", )
		}
		.MaxID = 
	}
	return nil
}

// GetMinID returns value of MinID field.
func ( *MessageRange) () ( int) {
	if  == nil {
		return
	}
	return .MinID
}

// GetMaxID returns value of MaxID field.
func ( *MessageRange) () ( int) {
	if  == nil {
		return
	}
	return .MaxID
}