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

// InputPasskeyCredentialPublicKey represents TL type `inputPasskeyCredentialPublicKey#3c27b78f`.
// Public-key passkey credential used both for registration and for login, see creating a
// passkey »¹ and logging in with a passkey »² for the full flows.
//
// Links:
//  1. https://core.telegram.org/api/passkeys#creating-a-passkey
//  2. https://core.telegram.org/api/passkeys#logging-in-with-a-passkey
//
// See https://core.telegram.org/constructor/inputPasskeyCredentialPublicKey for reference.
type InputPasskeyCredentialPublicKey struct {
	// id field of a PublicKeyCredential¹, passed as-is without base64url-decoding when
	// using the JSON representation
	//
	// Links:
	//  1) https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential
	ID string
	// rawId field of a PublicKeyCredential¹, passed as-is without base64url-decoding when
	// using the JSON representation
	//
	// Links:
	//  1) https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential
	RawID string
	// Registration or login response.
	Response InputPasskeyResponseClass
}

// InputPasskeyCredentialPublicKeyTypeID is TL type id of InputPasskeyCredentialPublicKey.
const InputPasskeyCredentialPublicKeyTypeID = 0x3c27b78f

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

func ( *InputPasskeyCredentialPublicKey) () bool {
	if  == nil {
		return true
	}
	if !(.ID == "") {
		return false
	}
	if !(.RawID == "") {
		return false
	}
	if !(.Response == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputPasskeyCredentialPublicKey from given interface.
func ( *InputPasskeyCredentialPublicKey) ( interface {
	() ( string)
	() ( string)
	() ( InputPasskeyResponseClass)
}) {
	.ID = .()
	.RawID = .()
	.Response = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputPasskeyCredentialPublicKey) () tdp.Type {
	 := tdp.Type{
		Name: "inputPasskeyCredentialPublicKey",
		ID:   InputPasskeyCredentialPublicKeyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "RawID",
			SchemaName: "raw_id",
		},
		{
			Name:       "Response",
			SchemaName: "response",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPasskeyCredentialPublicKey) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPasskeyCredentialPublicKey#3c27b78f as nil")
	}
	.PutID(InputPasskeyCredentialPublicKeyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPasskeyCredentialPublicKey) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPasskeyCredentialPublicKey#3c27b78f as nil")
	}
	.PutString(.ID)
	.PutString(.RawID)
	if .Response == nil {
		return fmt.Errorf("unable to encode inputPasskeyCredentialPublicKey#3c27b78f: field response is nil")
	}
	if  := .Response.Encode();  != nil {
		return fmt.Errorf("unable to encode inputPasskeyCredentialPublicKey#3c27b78f: field response: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPasskeyCredentialPublicKey) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPasskeyCredentialPublicKey#3c27b78f to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: field raw_id: %w", )
		}
		.RawID = 
	}
	{
		,  := DecodeInputPasskeyResponse()
		if  != nil {
			return fmt.Errorf("unable to decode inputPasskeyCredentialPublicKey#3c27b78f: field response: %w", )
		}
		.Response = 
	}
	return nil
}

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

// GetRawID returns value of RawID field.
func ( *InputPasskeyCredentialPublicKey) () ( string) {
	if  == nil {
		return
	}
	return .RawID
}

// GetResponse returns value of Response field.
func ( *InputPasskeyCredentialPublicKey) () ( InputPasskeyResponseClass) {
	if  == nil {
		return
	}
	return .Response
}