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

// AccountVerifyEmailRequest represents TL type `account.verifyEmail#32da4cf`.
// Verify an email address.
//
// See https://core.telegram.org/method/account.verifyEmail for reference.
type AccountVerifyEmailRequest struct {
	// Verification purpose
	Purpose EmailVerifyPurposeClass
	// Email verification code or token
	Verification EmailVerificationClass
}

// AccountVerifyEmailRequestTypeID is TL type id of AccountVerifyEmailRequest.
const AccountVerifyEmailRequestTypeID = 0x32da4cf

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

func ( *AccountVerifyEmailRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Purpose == nil) {
		return false
	}
	if !(.Verification == nil) {
		return false
	}

	return true
}

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

// FillFrom fills AccountVerifyEmailRequest from given interface.
func ( *AccountVerifyEmailRequest) ( interface {
	() ( EmailVerifyPurposeClass)
	() ( EmailVerificationClass)
}) {
	.Purpose = .()
	.Verification = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountVerifyEmailRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.verifyEmail",
		ID:   AccountVerifyEmailRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Purpose",
			SchemaName: "purpose",
		},
		{
			Name:       "Verification",
			SchemaName: "verification",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountVerifyEmailRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.verifyEmail#32da4cf as nil")
	}
	.PutID(AccountVerifyEmailRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountVerifyEmailRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.verifyEmail#32da4cf as nil")
	}
	if .Purpose == nil {
		return fmt.Errorf("unable to encode account.verifyEmail#32da4cf: field purpose is nil")
	}
	if  := .Purpose.Encode();  != nil {
		return fmt.Errorf("unable to encode account.verifyEmail#32da4cf: field purpose: %w", )
	}
	if .Verification == nil {
		return fmt.Errorf("unable to encode account.verifyEmail#32da4cf: field verification is nil")
	}
	if  := .Verification.Encode();  != nil {
		return fmt.Errorf("unable to encode account.verifyEmail#32da4cf: field verification: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountVerifyEmailRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.verifyEmail#32da4cf to nil")
	}
	{
		,  := DecodeEmailVerifyPurpose()
		if  != nil {
			return fmt.Errorf("unable to decode account.verifyEmail#32da4cf: field purpose: %w", )
		}
		.Purpose = 
	}
	{
		,  := DecodeEmailVerification()
		if  != nil {
			return fmt.Errorf("unable to decode account.verifyEmail#32da4cf: field verification: %w", )
		}
		.Verification = 
	}
	return nil
}

// GetPurpose returns value of Purpose field.
func ( *AccountVerifyEmailRequest) () ( EmailVerifyPurposeClass) {
	if  == nil {
		return
	}
	return .Purpose
}

// GetVerification returns value of Verification field.
func ( *AccountVerifyEmailRequest) () ( EmailVerificationClass) {
	if  == nil {
		return
	}
	return .Verification
}

// AccountVerifyEmail invokes method account.verifyEmail#32da4cf returning error if any.
// Verify an email address.
//
// Possible errors:
//
//	400 EMAIL_INVALID: The specified email is invalid.
//	400 EMAIL_VERIFY_EXPIRED: The verification email has expired.
//
// See https://core.telegram.org/method/account.verifyEmail for reference.
func ( *Client) ( context.Context,  *AccountVerifyEmailRequest) (AccountEmailVerifiedClass, error) {
	var  AccountEmailVerifiedBox

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