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

// AccountResetPasswordFailedWait represents TL type `account.resetPasswordFailedWait#e3779861`.
// You recently requested a password reset that was canceled, please wait until the
// specified date before requesting another reset.
//
// See https://core.telegram.org/constructor/account.resetPasswordFailedWait for reference.
type AccountResetPasswordFailedWait struct {
	// Wait until this date before requesting another reset.
	RetryDate int
}

// AccountResetPasswordFailedWaitTypeID is TL type id of AccountResetPasswordFailedWait.
const AccountResetPasswordFailedWaitTypeID = 0xe3779861

// construct implements constructor of AccountResetPasswordResultClass.
func ( AccountResetPasswordFailedWait) () AccountResetPasswordResultClass { return & }

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

	_ AccountResetPasswordResultClass = &AccountResetPasswordFailedWait{}
)

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

	return true
}

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

// FillFrom fills AccountResetPasswordFailedWait from given interface.
func ( *AccountResetPasswordFailedWait) ( interface {
	() ( int)
}) {
	.RetryDate = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountResetPasswordFailedWait) () string {
	return "account.resetPasswordFailedWait"
}

// TypeInfo returns info about TL type.
func ( *AccountResetPasswordFailedWait) () tdp.Type {
	 := tdp.Type{
		Name: "account.resetPasswordFailedWait",
		ID:   AccountResetPasswordFailedWaitTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "RetryDate",
			SchemaName: "retry_date",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountResetPasswordFailedWait) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.resetPasswordFailedWait#e3779861 as nil")
	}
	.PutID(AccountResetPasswordFailedWaitTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountResetPasswordFailedWait) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.resetPasswordFailedWait#e3779861 as nil")
	}
	.PutInt(.RetryDate)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountResetPasswordFailedWait) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.resetPasswordFailedWait#e3779861 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode account.resetPasswordFailedWait#e3779861: field retry_date: %w", )
		}
		.RetryDate = 
	}
	return nil
}

// GetRetryDate returns value of RetryDate field.
func ( *AccountResetPasswordFailedWait) () ( int) {
	if  == nil {
		return
	}
	return .RetryDate
}

// AccountResetPasswordRequestedWait represents TL type `account.resetPasswordRequestedWait#e9effc7d`.
// You successfully requested a password reset, please wait until the specified date
// before finalizing the reset.
//
// See https://core.telegram.org/constructor/account.resetPasswordRequestedWait for reference.
type AccountResetPasswordRequestedWait struct {
	// Wait until this date before finalizing the reset.
	UntilDate int
}

// AccountResetPasswordRequestedWaitTypeID is TL type id of AccountResetPasswordRequestedWait.
const AccountResetPasswordRequestedWaitTypeID = 0xe9effc7d

// construct implements constructor of AccountResetPasswordResultClass.
func ( AccountResetPasswordRequestedWait) () AccountResetPasswordResultClass { return & }

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

	_ AccountResetPasswordResultClass = &AccountResetPasswordRequestedWait{}
)

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

	return true
}

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

// FillFrom fills AccountResetPasswordRequestedWait from given interface.
func ( *AccountResetPasswordRequestedWait) ( interface {
	() ( int)
}) {
	.UntilDate = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountResetPasswordRequestedWait) () string {
	return "account.resetPasswordRequestedWait"
}

// TypeInfo returns info about TL type.
func ( *AccountResetPasswordRequestedWait) () tdp.Type {
	 := tdp.Type{
		Name: "account.resetPasswordRequestedWait",
		ID:   AccountResetPasswordRequestedWaitTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UntilDate",
			SchemaName: "until_date",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountResetPasswordRequestedWait) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.resetPasswordRequestedWait#e9effc7d as nil")
	}
	.PutID(AccountResetPasswordRequestedWaitTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountResetPasswordRequestedWait) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.resetPasswordRequestedWait#e9effc7d as nil")
	}
	.PutInt(.UntilDate)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountResetPasswordRequestedWait) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.resetPasswordRequestedWait#e9effc7d to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode account.resetPasswordRequestedWait#e9effc7d: field until_date: %w", )
		}
		.UntilDate = 
	}
	return nil
}

// GetUntilDate returns value of UntilDate field.
func ( *AccountResetPasswordRequestedWait) () ( int) {
	if  == nil {
		return
	}
	return .UntilDate
}

// AccountResetPasswordOk represents TL type `account.resetPasswordOk#e926d63e`.
// The 2FA password was reset successfully.
//
// See https://core.telegram.org/constructor/account.resetPasswordOk for reference.
type AccountResetPasswordOk struct {
}

// AccountResetPasswordOkTypeID is TL type id of AccountResetPasswordOk.
const AccountResetPasswordOkTypeID = 0xe926d63e

// construct implements constructor of AccountResetPasswordResultClass.
func ( AccountResetPasswordOk) () AccountResetPasswordResultClass { return & }

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

	_ AccountResetPasswordResultClass = &AccountResetPasswordOk{}
)

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

	return true
}

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

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

// TypeName returns name of type in TL schema.
func (*AccountResetPasswordOk) () string {
	return "account.resetPasswordOk"
}

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

// Encode implements bin.Encoder.
func ( *AccountResetPasswordOk) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.resetPasswordOk#e926d63e as nil")
	}
	.PutID(AccountResetPasswordOkTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountResetPasswordOk) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.resetPasswordOk#e926d63e as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountResetPasswordOk) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.resetPasswordOk#e926d63e to nil")
	}
	return nil
}

// AccountResetPasswordResultClassName is schema name of AccountResetPasswordResultClass.
const AccountResetPasswordResultClassName = "account.ResetPasswordResult"

// AccountResetPasswordResultClass represents account.ResetPasswordResult generic type.
//
// See https://core.telegram.org/type/account.ResetPasswordResult for reference.
//
// Example:
//
//	g, err := tg.DecodeAccountResetPasswordResult(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.AccountResetPasswordFailedWait: // account.resetPasswordFailedWait#e3779861
//	case *tg.AccountResetPasswordRequestedWait: // account.resetPasswordRequestedWait#e9effc7d
//	case *tg.AccountResetPasswordOk: // account.resetPasswordOk#e926d63e
//	default: panic(v)
//	}
type AccountResetPasswordResultClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() AccountResetPasswordResultClass

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

// DecodeAccountResetPasswordResult implements binary de-serialization for AccountResetPasswordResultClass.
func ( *bin.Buffer) (AccountResetPasswordResultClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case AccountResetPasswordFailedWaitTypeID:
		// Decoding account.resetPasswordFailedWait#e3779861.
		 := AccountResetPasswordFailedWait{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode AccountResetPasswordResultClass: %w", )
		}
		return &, nil
	case AccountResetPasswordRequestedWaitTypeID:
		// Decoding account.resetPasswordRequestedWait#e9effc7d.
		 := AccountResetPasswordRequestedWait{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode AccountResetPasswordResultClass: %w", )
		}
		return &, nil
	case AccountResetPasswordOkTypeID:
		// Decoding account.resetPasswordOk#e926d63e.
		 := AccountResetPasswordOk{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode AccountResetPasswordResultClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode AccountResetPasswordResultClass: %w", bin.NewUnexpectedID())
	}
}

// AccountResetPasswordResult boxes the AccountResetPasswordResultClass providing a helper.
type AccountResetPasswordResultBox struct {
	ResetPasswordResult AccountResetPasswordResultClass
}

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

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