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

// MessagesHistoryImport represents TL type `messages.historyImport#1662af0b`.
// ID of a specific chat import session, click here for more info »¹.
//
// Links:
//  1. https://core.telegram.org/api/import
//
// See https://core.telegram.org/constructor/messages.historyImport for reference.
type MessagesHistoryImport struct {
	// History import ID¹
	//
	// Links:
	//  1) https://core.telegram.org/api/import
	ID int64
}

// MessagesHistoryImportTypeID is TL type id of MessagesHistoryImport.
const MessagesHistoryImportTypeID = 0x1662af0b

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

func ( *MessagesHistoryImport) () bool {
	if  == nil {
		return true
	}
	if !(.ID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesHistoryImport from given interface.
func ( *MessagesHistoryImport) ( interface {
	() ( int64)
}) {
	.ID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesHistoryImport) () tdp.Type {
	 := tdp.Type{
		Name: "messages.historyImport",
		ID:   MessagesHistoryImportTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesHistoryImport) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.historyImport#1662af0b as nil")
	}
	.PutID(MessagesHistoryImportTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesHistoryImport) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.historyImport#1662af0b as nil")
	}
	.PutLong(.ID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesHistoryImport) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.historyImport#1662af0b to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode messages.historyImport#1662af0b: field id: %w", )
		}
		.ID = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *MessagesHistoryImport) () ( int64) {
	if  == nil {
		return
	}
	return .ID
}