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

// SearchResultPosition represents TL type `searchResultPosition#7f648b67`.
// Information about a message in a specific position
//
// See https://core.telegram.org/constructor/searchResultPosition for reference.
type SearchResultPosition struct {
	// Message ID
	MsgID int
	// When was the message sent
	Date int
	// 0-based message position in the full list of suitable messages
	Offset int
}

// SearchResultPositionTypeID is TL type id of SearchResultPosition.
const SearchResultPositionTypeID = 0x7f648b67

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

func ( *SearchResultPosition) () bool {
	if  == nil {
		return true
	}
	if !(.MsgID == 0) {
		return false
	}
	if !(.Date == 0) {
		return false
	}
	if !(.Offset == 0) {
		return false
	}

	return true
}

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

// FillFrom fills SearchResultPosition from given interface.
func ( *SearchResultPosition) ( interface {
	() ( int)
	() ( int)
	() ( int)
}) {
	.MsgID = .()
	.Date = .()
	.Offset = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *SearchResultPosition) () tdp.Type {
	 := tdp.Type{
		Name: "searchResultPosition",
		ID:   SearchResultPositionTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
		{
			Name:       "Offset",
			SchemaName: "offset",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *SearchResultPosition) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode searchResultPosition#7f648b67 as nil")
	}
	.PutID(SearchResultPositionTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *SearchResultPosition) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode searchResultPosition#7f648b67 as nil")
	}
	.PutInt(.MsgID)
	.PutInt(.Date)
	.PutInt(.Offset)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *SearchResultPosition) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode searchResultPosition#7f648b67 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode searchResultPosition#7f648b67: field msg_id: %w", )
		}
		.MsgID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode searchResultPosition#7f648b67: field date: %w", )
		}
		.Date = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode searchResultPosition#7f648b67: field offset: %w", )
		}
		.Offset = 
	}
	return nil
}

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

// GetDate returns value of Date field.
func ( *SearchResultPosition) () ( int) {
	if  == nil {
		return
	}
	return .Date
}

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