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

// UsersSetSecureValueErrorsRequest represents TL type `users.setSecureValueErrors#90c894b5`.
// Notify the user that the sent passport¹ data contains some errors The user will not
// be able to re-submit their Passport data to you until the errors are fixed (the
// contents of the field for which you returned the error must change).
// Use this if the data submitted by the user doesn't satisfy the standards your service
// requires for any reason. For example, if a birthday date seems invalid, a submitted
// document is blurry, a scan shows evidence of tampering, etc. Supply some details in
// the error message to make sure the user knows how to correct the issues.
//
// Links:
//  1. https://core.telegram.org/passport
//
// See https://core.telegram.org/method/users.setSecureValueErrors for reference.
type UsersSetSecureValueErrorsRequest struct {
	// The user
	ID InputUserClass
	// Errors
	Errors []SecureValueErrorClass
}

// UsersSetSecureValueErrorsRequestTypeID is TL type id of UsersSetSecureValueErrorsRequest.
const UsersSetSecureValueErrorsRequestTypeID = 0x90c894b5

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

func ( *UsersSetSecureValueErrorsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.ID == nil) {
		return false
	}
	if !(.Errors == nil) {
		return false
	}

	return true
}

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

// FillFrom fills UsersSetSecureValueErrorsRequest from given interface.
func ( *UsersSetSecureValueErrorsRequest) ( interface {
	() ( InputUserClass)
	() ( []SecureValueErrorClass)
}) {
	.ID = .()
	.Errors = .()
}

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

// TypeName returns name of type in TL schema.
func (*UsersSetSecureValueErrorsRequest) () string {
	return "users.setSecureValueErrors"
}

// TypeInfo returns info about TL type.
func ( *UsersSetSecureValueErrorsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "users.setSecureValueErrors",
		ID:   UsersSetSecureValueErrorsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Errors",
			SchemaName: "errors",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *UsersSetSecureValueErrorsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode users.setSecureValueErrors#90c894b5 as nil")
	}
	.PutID(UsersSetSecureValueErrorsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *UsersSetSecureValueErrorsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode users.setSecureValueErrors#90c894b5 as nil")
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode users.setSecureValueErrors#90c894b5: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode users.setSecureValueErrors#90c894b5: field id: %w", )
	}
	.PutVectorHeader(len(.Errors))
	for ,  := range .Errors {
		if  == nil {
			return fmt.Errorf("unable to encode users.setSecureValueErrors#90c894b5: field errors element with index %d is nil", )
		}
		if  := .Encode();  != nil {
			return fmt.Errorf("unable to encode users.setSecureValueErrors#90c894b5: field errors element with index %d: %w", , )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *UsersSetSecureValueErrorsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode users.setSecureValueErrors#90c894b5 to nil")
	}
	if  := .ConsumeID(UsersSetSecureValueErrorsRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode users.setSecureValueErrors#90c894b5: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *UsersSetSecureValueErrorsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode users.setSecureValueErrors#90c894b5 to nil")
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode users.setSecureValueErrors#90c894b5: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode users.setSecureValueErrors#90c894b5: field errors: %w", )
		}

		if  > 0 {
			.Errors = make([]SecureValueErrorClass, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := DecodeSecureValueError()
			if  != nil {
				return fmt.Errorf("unable to decode users.setSecureValueErrors#90c894b5: field errors: %w", )
			}
			.Errors = append(.Errors, )
		}
	}
	return nil
}

// GetID returns value of ID field.
func ( *UsersSetSecureValueErrorsRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .ID
}

// GetErrors returns value of Errors field.
func ( *UsersSetSecureValueErrorsRequest) () ( []SecureValueErrorClass) {
	if  == nil {
		return
	}
	return .Errors
}

// MapErrors returns field Errors wrapped in SecureValueErrorClassArray helper.
func ( *UsersSetSecureValueErrorsRequest) () ( SecureValueErrorClassArray) {
	return SecureValueErrorClassArray(.Errors)
}

// UsersSetSecureValueErrors invokes method users.setSecureValueErrors#90c894b5 returning error if any.
// Notify the user that the sent passport¹ data contains some errors The user will not
// be able to re-submit their Passport data to you until the errors are fixed (the
// contents of the field for which you returned the error must change).
// Use this if the data submitted by the user doesn't satisfy the standards your service
// requires for any reason. For example, if a birthday date seems invalid, a submitted
// document is blurry, a scan shows evidence of tampering, etc. Supply some details in
// the error message to make sure the user knows how to correct the issues.
//
// Links:
//  1. https://core.telegram.org/passport
//
// Possible errors:
//
//	403 USER_BOT_INVALID: User accounts must provide the bot method parameter when calling this method. If there is no such method parameter, this method can only be invoked by bot accounts.
//	400 USER_BOT_REQUIRED: This method can only be called by a bot.
//	400 USER_ID_INVALID: The provided user ID is invalid.
//
// See https://core.telegram.org/method/users.setSecureValueErrors for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *UsersSetSecureValueErrorsRequest) (bool, error) {
	var  BoolBox

	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}