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

// InputUserEmpty represents TL type `inputUserEmpty#b98886cf`.
// Empty constructor, does not define a user.
//
// See https://core.telegram.org/constructor/inputUserEmpty for reference.
type InputUserEmpty struct {
}

// InputUserEmptyTypeID is TL type id of InputUserEmpty.
const InputUserEmptyTypeID = 0xb98886cf

// construct implements constructor of InputUserClass.
func ( InputUserEmpty) () InputUserClass { return & }

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

	_ InputUserClass = &InputUserEmpty{}
)

func ( *InputUserEmpty) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *InputUserEmpty) () tdp.Type {
	 := tdp.Type{
		Name: "inputUserEmpty",
		ID:   InputUserEmptyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *InputUserEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputUserEmpty#b98886cf as nil")
	}
	.PutID(InputUserEmptyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputUserEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputUserEmpty#b98886cf as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputUserEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputUserEmpty#b98886cf to nil")
	}
	return nil
}

// InputUserSelf represents TL type `inputUserSelf#f7c1b13f`.
// Defines the current user.
//
// See https://core.telegram.org/constructor/inputUserSelf for reference.
type InputUserSelf struct {
}

// InputUserSelfTypeID is TL type id of InputUserSelf.
const InputUserSelfTypeID = 0xf7c1b13f

// construct implements constructor of InputUserClass.
func ( InputUserSelf) () InputUserClass { return & }

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

	_ InputUserClass = &InputUserSelf{}
)

func ( *InputUserSelf) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *InputUserSelf) () tdp.Type {
	 := tdp.Type{
		Name: "inputUserSelf",
		ID:   InputUserSelfTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *InputUserSelf) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputUserSelf#f7c1b13f as nil")
	}
	.PutID(InputUserSelfTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputUserSelf) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputUserSelf#f7c1b13f as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputUserSelf) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputUserSelf#f7c1b13f to nil")
	}
	return nil
}

// InputUser represents TL type `inputUser#f21158c6`.
// Defines a user for further interaction.
//
// See https://core.telegram.org/constructor/inputUser for reference.
type InputUser struct {
	// User identifier
	UserID int64
	// access_hash value from the userĀ¹ constructor
	//
	// Links:
	//  1) https://core.telegram.org/constructor/user
	AccessHash int64
}

// InputUserTypeID is TL type id of InputUser.
const InputUserTypeID = 0xf21158c6

// construct implements constructor of InputUserClass.
func ( InputUser) () InputUserClass { return & }

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

	_ InputUserClass = &InputUser{}
)

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

	return true
}

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

// FillFrom fills InputUser from given interface.
func ( *InputUser) ( interface {
	() ( int64)
	() ( int64)
}) {
	.UserID = .()
	.AccessHash = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputUser) () tdp.Type {
	 := tdp.Type{
		Name: "inputUser",
		ID:   InputUserTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "AccessHash",
			SchemaName: "access_hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputUser) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputUser#f21158c6 as nil")
	}
	.PutID(InputUserTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputUser) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputUser#f21158c6 as nil")
	}
	.PutLong(.UserID)
	.PutLong(.AccessHash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputUser) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputUser#f21158c6 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputUser#f21158c6: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputUser#f21158c6: field access_hash: %w", )
		}
		.AccessHash = 
	}
	return nil
}

// GetUserID returns value of UserID field.
func ( *InputUser) () ( int64) {
	if  == nil {
		return
	}
	return .UserID
}

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

// InputUserFromMessage represents TL type `inputUserFromMessage#1da448e2`.
// Defines a minĀ¹ user that was seen in a certain message of a certain chat.
//
// Links:
//  1. https://core.telegram.org/api/min
//
// See https://core.telegram.org/constructor/inputUserFromMessage for reference.
type InputUserFromMessage struct {
	// The chat where the user was seen
	Peer InputPeerClass
	// The message ID
	MsgID int
	// The identifier of the user that was seen
	UserID int64
}

// InputUserFromMessageTypeID is TL type id of InputUserFromMessage.
const InputUserFromMessageTypeID = 0x1da448e2

// construct implements constructor of InputUserClass.
func ( InputUserFromMessage) () InputUserClass { return & }

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

	_ InputUserClass = &InputUserFromMessage{}
)

func ( *InputUserFromMessage) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.MsgID == 0) {
		return false
	}
	if !(.UserID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills InputUserFromMessage from given interface.
func ( *InputUserFromMessage) ( interface {
	() ( InputPeerClass)
	() ( int)
	() ( int64)
}) {
	.Peer = .()
	.MsgID = .()
	.UserID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputUserFromMessage) () tdp.Type {
	 := tdp.Type{
		Name: "inputUserFromMessage",
		ID:   InputUserFromMessageTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputUserFromMessage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputUserFromMessage#1da448e2 as nil")
	}
	.PutID(InputUserFromMessageTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputUserFromMessage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputUserFromMessage#1da448e2 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode inputUserFromMessage#1da448e2: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode inputUserFromMessage#1da448e2: field peer: %w", )
	}
	.PutInt(.MsgID)
	.PutLong(.UserID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputUserFromMessage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputUserFromMessage#1da448e2 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode inputUserFromMessage#1da448e2: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputUserFromMessage#1da448e2: field msg_id: %w", )
		}
		.MsgID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputUserFromMessage#1da448e2: field user_id: %w", )
		}
		.UserID = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *InputUserFromMessage) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

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

// GetUserID returns value of UserID field.
func ( *InputUserFromMessage) () ( int64) {
	if  == nil {
		return
	}
	return .UserID
}

// InputUserClassName is schema name of InputUserClass.
const InputUserClassName = "InputUser"

// InputUserClass represents InputUser generic type.
//
// See https://core.telegram.org/type/InputUser for reference.
//
// Example:
//
//	g, err := tg.DecodeInputUser(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputUserEmpty: // inputUserEmpty#b98886cf
//	case *tg.InputUserSelf: // inputUserSelf#f7c1b13f
//	case *tg.InputUser: // inputUser#f21158c6
//	case *tg.InputUserFromMessage: // inputUserFromMessage#1da448e2
//	default: panic(v)
//	}
type InputUserClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputUserClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodeInputUser implements binary de-serialization for InputUserClass.
func ( *bin.Buffer) (InputUserClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputUserEmptyTypeID:
		// Decoding inputUserEmpty#b98886cf.
		 := InputUserEmpty{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputUserClass: %w", )
		}
		return &, nil
	case InputUserSelfTypeID:
		// Decoding inputUserSelf#f7c1b13f.
		 := InputUserSelf{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputUserClass: %w", )
		}
		return &, nil
	case InputUserTypeID:
		// Decoding inputUser#f21158c6.
		 := InputUser{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputUserClass: %w", )
		}
		return &, nil
	case InputUserFromMessageTypeID:
		// Decoding inputUserFromMessage#1da448e2.
		 := InputUserFromMessage{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputUserClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputUserClass: %w", bin.NewUnexpectedID())
	}
}

// InputUser boxes the InputUserClass providing a helper.
type InputUserBox struct {
	InputUser InputUserClass
}

// Decode implements bin.Decoder for InputUserBox.
func ( *InputUserBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode InputUserBox to nil")
	}
	,  := DecodeInputUser()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.InputUser = 
	return nil
}

// Encode implements bin.Encode for InputUserBox.
func ( *InputUserBox) ( *bin.Buffer) error {
	if  == nil || .InputUser == nil {
		return fmt.Errorf("unable to encode InputUserClass as nil")
	}
	return .InputUser.Encode()
}