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

// AuthResetLoginEmailRequest represents TL type `auth.resetLoginEmail#7e960193`.
// Reset the login email »¹.
//
// Links:
//  1. https://core.telegram.org/api/auth#email-verification
//
// See https://core.telegram.org/method/auth.resetLoginEmail for reference.
type AuthResetLoginEmailRequest struct {
	// Phone number of the account
	PhoneNumber string
	// Phone code hash, obtained as described in the documentation »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/auth
	PhoneCodeHash string
}

// AuthResetLoginEmailRequestTypeID is TL type id of AuthResetLoginEmailRequest.
const AuthResetLoginEmailRequestTypeID = 0x7e960193

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

func ( *AuthResetLoginEmailRequest) () bool {
	if  == nil {
		return true
	}
	if !(.PhoneNumber == "") {
		return false
	}
	if !(.PhoneCodeHash == "") {
		return false
	}

	return true
}

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

// FillFrom fills AuthResetLoginEmailRequest from given interface.
func ( *AuthResetLoginEmailRequest) ( interface {
	() ( string)
	() ( string)
}) {
	.PhoneNumber = .()
	.PhoneCodeHash = .()
}

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

// TypeName returns name of type in TL schema.
func (*AuthResetLoginEmailRequest) () string {
	return "auth.resetLoginEmail"
}

// TypeInfo returns info about TL type.
func ( *AuthResetLoginEmailRequest) () tdp.Type {
	 := tdp.Type{
		Name: "auth.resetLoginEmail",
		ID:   AuthResetLoginEmailRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
		{
			Name:       "PhoneCodeHash",
			SchemaName: "phone_code_hash",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AuthResetLoginEmailRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.resetLoginEmail#7e960193 as nil")
	}
	.PutID(AuthResetLoginEmailRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AuthResetLoginEmailRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode auth.resetLoginEmail#7e960193 as nil")
	}
	.PutString(.PhoneNumber)
	.PutString(.PhoneCodeHash)
	return nil
}

// Decode implements bin.Decoder.
func ( *AuthResetLoginEmailRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.resetLoginEmail#7e960193 to nil")
	}
	if  := .ConsumeID(AuthResetLoginEmailRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode auth.resetLoginEmail#7e960193: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AuthResetLoginEmailRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode auth.resetLoginEmail#7e960193 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode auth.resetLoginEmail#7e960193: field phone_number: %w", )
		}
		.PhoneNumber = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode auth.resetLoginEmail#7e960193: field phone_code_hash: %w", )
		}
		.PhoneCodeHash = 
	}
	return nil
}

// GetPhoneNumber returns value of PhoneNumber field.
func ( *AuthResetLoginEmailRequest) () ( string) {
	if  == nil {
		return
	}
	return .PhoneNumber
}

// GetPhoneCodeHash returns value of PhoneCodeHash field.
func ( *AuthResetLoginEmailRequest) () ( string) {
	if  == nil {
		return
	}
	return .PhoneCodeHash
}

// AuthResetLoginEmail invokes method auth.resetLoginEmail#7e960193 returning error if any.
// Reset the login email »¹.
//
// Links:
//  1. https://core.telegram.org/api/auth#email-verification
//
// Possible errors:
//
//	400 PHONE_NUMBER_INVALID: The phone number is invalid.
//	400 TASK_ALREADY_EXISTS: An email reset was already requested.
//
// See https://core.telegram.org/method/auth.resetLoginEmail for reference.
func ( *Client) ( context.Context,  *AuthResetLoginEmailRequest) (AuthSentCodeClass, error) {
	var  AuthSentCodeBox

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .SentCode, nil
}