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

// InputEncryptedChat represents TL type `inputEncryptedChat#f141b5e1`.
// Creates an encrypted chat.
//
// See https://core.telegram.org/constructor/inputEncryptedChat for reference.
type InputEncryptedChat struct {
	// Chat ID
	ChatID int
	// Checking sum from constructor encryptedChat¹, encryptedChatWaiting² or
	// encryptedChatRequested³
	//
	// Links:
	//  1) https://core.telegram.org/constructor/encryptedChat
	//  2) https://core.telegram.org/constructor/encryptedChatWaiting
	//  3) https://core.telegram.org/constructor/encryptedChatRequested
	AccessHash int64
}

// InputEncryptedChatTypeID is TL type id of InputEncryptedChat.
const InputEncryptedChatTypeID = 0xf141b5e1

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

func ( *InputEncryptedChat) () bool {
	if  == nil {
		return true
	}
	if !(.ChatID == 0) {
		return false
	}
	if !(.AccessHash == 0) {
		return false
	}

	return true
}

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

// FillFrom fills InputEncryptedChat from given interface.
func ( *InputEncryptedChat) ( interface {
	() ( int)
	() ( int64)
}) {
	.ChatID = .()
	.AccessHash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputEncryptedChat) () tdp.Type {
	 := tdp.Type{
		Name: "inputEncryptedChat",
		ID:   InputEncryptedChatTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ChatID",
			SchemaName: "chat_id",
		},
		{
			Name:       "AccessHash",
			SchemaName: "access_hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputEncryptedChat) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputEncryptedChat#f141b5e1 as nil")
	}
	.PutID(InputEncryptedChatTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputEncryptedChat) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputEncryptedChat#f141b5e1 as nil")
	}
	.PutInt(.ChatID)
	.PutLong(.AccessHash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputEncryptedChat) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputEncryptedChat#f141b5e1 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputEncryptedChat#f141b5e1: field chat_id: %w", )
		}
		.ChatID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputEncryptedChat#f141b5e1: field access_hash: %w", )
		}
		.AccessHash = 
	}
	return nil
}

// GetChatID returns value of ChatID field.
func ( *InputEncryptedChat) () ( int) {
	if  == nil {
		return
	}
	return .ChatID
}

// GetAccessHash returns value of AccessHash field.
func ( *InputEncryptedChat) () ( int64) {
	if  == nil {
		return
	}
	return .AccessHash
}