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

// AccountPasskeyRegistrationOptions represents TL type `account.passkeyRegistrationOptions#e16b5ce1`.
// Passkey registration options, see here »¹ for more info on the full flow.
//
// Links:
//  1. https://core.telegram.org/api/passkeys#creating-a-passkey
//
// See https://core.telegram.org/constructor/account.passkeyRegistrationOptions for reference.
type AccountPasskeyRegistrationOptions struct {
	// JSON-encoded object whose publicKey field contains a
	// PublicKeyCredentialCreationOptions¹ object.
	//
	// Links:
	//  1) https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredentialCreationOptions
	Options DataJSON
}

// AccountPasskeyRegistrationOptionsTypeID is TL type id of AccountPasskeyRegistrationOptions.
const AccountPasskeyRegistrationOptionsTypeID = 0xe16b5ce1

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

func ( *AccountPasskeyRegistrationOptions) () bool {
	if  == nil {
		return true
	}
	if !(.Options.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills AccountPasskeyRegistrationOptions from given interface.
func ( *AccountPasskeyRegistrationOptions) ( interface {
	() ( DataJSON)
}) {
	.Options = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *AccountPasskeyRegistrationOptions) () tdp.Type {
	 := tdp.Type{
		Name: "account.passkeyRegistrationOptions",
		ID:   AccountPasskeyRegistrationOptionsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Options",
			SchemaName: "options",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountPasskeyRegistrationOptions) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.passkeyRegistrationOptions#e16b5ce1 as nil")
	}
	.PutID(AccountPasskeyRegistrationOptionsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountPasskeyRegistrationOptions) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.passkeyRegistrationOptions#e16b5ce1 as nil")
	}
	if  := .Options.Encode();  != nil {
		return fmt.Errorf("unable to encode account.passkeyRegistrationOptions#e16b5ce1: field options: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *AccountPasskeyRegistrationOptions) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.passkeyRegistrationOptions#e16b5ce1 to nil")
	}
	{
		if  := .Options.Decode();  != nil {
			return fmt.Errorf("unable to decode account.passkeyRegistrationOptions#e16b5ce1: field options: %w", )
		}
	}
	return nil
}

// GetOptions returns value of Options field.
func ( *AccountPasskeyRegistrationOptions) () ( DataJSON) {
	if  == nil {
		return
	}
	return .Options
}