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

// InputCheckPasswordEmpty represents TL type `inputCheckPasswordEmpty#9880f658`.
// There is no password
//
// See https://core.telegram.org/constructor/inputCheckPasswordEmpty for reference.
type InputCheckPasswordEmpty struct {
}

// InputCheckPasswordEmptyTypeID is TL type id of InputCheckPasswordEmpty.
const InputCheckPasswordEmptyTypeID = 0x9880f658

// construct implements constructor of InputCheckPasswordSRPClass.
func ( InputCheckPasswordEmpty) () InputCheckPasswordSRPClass { return & }

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

	_ InputCheckPasswordSRPClass = &InputCheckPasswordEmpty{}
)

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

	return true
}

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

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

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

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

// Encode implements bin.Encoder.
func ( *InputCheckPasswordEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputCheckPasswordEmpty#9880f658 as nil")
	}
	.PutID(InputCheckPasswordEmptyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputCheckPasswordEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputCheckPasswordEmpty#9880f658 as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputCheckPasswordEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputCheckPasswordEmpty#9880f658 to nil")
	}
	return nil
}

// InputCheckPasswordSRP represents TL type `inputCheckPasswordSRP#d27ff082`.
// Constructor for checking the validity of a 2FA SRP password (see SRP¹)
//
// Links:
//  1. https://core.telegram.org/api/srp
//
// See https://core.telegram.org/constructor/inputCheckPasswordSRP for reference.
type InputCheckPasswordSRP struct {
	// SRP ID¹
	//
	// Links:
	//  1) https://core.telegram.org/api/srp
	SRPID int64
	// A parameter (see SRP¹)
	//
	// Links:
	//  1) https://core.telegram.org/api/srp
	A []byte
	// M1 parameter (see SRP¹)
	//
	// Links:
	//  1) https://core.telegram.org/api/srp
	M1 []byte
}

// InputCheckPasswordSRPTypeID is TL type id of InputCheckPasswordSRP.
const InputCheckPasswordSRPTypeID = 0xd27ff082

// construct implements constructor of InputCheckPasswordSRPClass.
func ( InputCheckPasswordSRP) () InputCheckPasswordSRPClass { return & }

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

	_ InputCheckPasswordSRPClass = &InputCheckPasswordSRP{}
)

func ( *InputCheckPasswordSRP) () bool {
	if  == nil {
		return true
	}
	if !(.SRPID == 0) {
		return false
	}
	if !(.A == nil) {
		return false
	}
	if !(.M1 == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputCheckPasswordSRP from given interface.
func ( *InputCheckPasswordSRP) ( interface {
	() ( int64)
	() ( []byte)
	() ( []byte)
}) {
	.SRPID = .()
	.A = .()
	.M1 = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputCheckPasswordSRP) () tdp.Type {
	 := tdp.Type{
		Name: "inputCheckPasswordSRP",
		ID:   InputCheckPasswordSRPTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "SRPID",
			SchemaName: "srp_id",
		},
		{
			Name:       "A",
			SchemaName: "A",
		},
		{
			Name:       "M1",
			SchemaName: "M1",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputCheckPasswordSRP) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputCheckPasswordSRP#d27ff082 as nil")
	}
	.PutID(InputCheckPasswordSRPTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputCheckPasswordSRP) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputCheckPasswordSRP#d27ff082 as nil")
	}
	.PutLong(.SRPID)
	.PutBytes(.A)
	.PutBytes(.M1)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputCheckPasswordSRP) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputCheckPasswordSRP#d27ff082 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputCheckPasswordSRP#d27ff082: field srp_id: %w", )
		}
		.SRPID = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode inputCheckPasswordSRP#d27ff082: field A: %w", )
		}
		.A = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode inputCheckPasswordSRP#d27ff082: field M1: %w", )
		}
		.M1 = 
	}
	return nil
}

// GetSRPID returns value of SRPID field.
func ( *InputCheckPasswordSRP) () ( int64) {
	if  == nil {
		return
	}
	return .SRPID
}

// GetA returns value of A field.
func ( *InputCheckPasswordSRP) () ( []byte) {
	if  == nil {
		return
	}
	return .A
}

// GetM1 returns value of M1 field.
func ( *InputCheckPasswordSRP) () ( []byte) {
	if  == nil {
		return
	}
	return .M1
}

// InputCheckPasswordSRPClassName is schema name of InputCheckPasswordSRPClass.
const InputCheckPasswordSRPClassName = "InputCheckPasswordSRP"

// InputCheckPasswordSRPClass represents InputCheckPasswordSRP generic type.
//
// See https://core.telegram.org/type/InputCheckPasswordSRP for reference.
//
// Example:
//
//	g, err := tg.DecodeInputCheckPasswordSRP(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputCheckPasswordEmpty: // inputCheckPasswordEmpty#9880f658
//	case *tg.InputCheckPasswordSRP: // inputCheckPasswordSRP#d27ff082
//	default: panic(v)
//	}
type InputCheckPasswordSRPClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputCheckPasswordSRPClass

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

	// AsNotEmpty tries to map InputCheckPasswordSRPClass to InputCheckPasswordSRP.
	AsNotEmpty() (*InputCheckPasswordSRP, bool)
}

// AsNotEmpty tries to map InputCheckPasswordEmpty to InputCheckPasswordSRP.
func ( *InputCheckPasswordEmpty) () (*InputCheckPasswordSRP, bool) {
	return nil, false
}

// AsNotEmpty tries to map InputCheckPasswordSRP to InputCheckPasswordSRP.
func ( *InputCheckPasswordSRP) () (*InputCheckPasswordSRP, bool) {
	return , true
}

// DecodeInputCheckPasswordSRP implements binary de-serialization for InputCheckPasswordSRPClass.
func ( *bin.Buffer) (InputCheckPasswordSRPClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputCheckPasswordEmptyTypeID:
		// Decoding inputCheckPasswordEmpty#9880f658.
		 := InputCheckPasswordEmpty{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputCheckPasswordSRPClass: %w", )
		}
		return &, nil
	case InputCheckPasswordSRPTypeID:
		// Decoding inputCheckPasswordSRP#d27ff082.
		 := InputCheckPasswordSRP{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputCheckPasswordSRPClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputCheckPasswordSRPClass: %w", bin.NewUnexpectedID())
	}
}

// InputCheckPasswordSRP boxes the InputCheckPasswordSRPClass providing a helper.
type InputCheckPasswordSRPBox struct {
	InputCheckPasswordSRP InputCheckPasswordSRPClass
}

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

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