// Code generated by Microsoft Kiota - DO NOT EDIT.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

package models

import (
    i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)

type PasskeyProfile struct {
    Entity
}
// NewPasskeyProfile instantiates a new PasskeyProfile and sets the default values.
func NewPasskeyProfile()(*PasskeyProfile) {
    m := &PasskeyProfile{
        Entity: *NewEntity(),
    }
    return m
}
// CreatePasskeyProfileFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
// returns a Parsable when successful
func CreatePasskeyProfileFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
    return NewPasskeyProfile(), nil
}
// GetAttestationEnforcement gets the attestationEnforcement property value. The attestationEnforcement property
// returns a *AttestationEnforcement when successful
func (m *PasskeyProfile) GetAttestationEnforcement()(*AttestationEnforcement) {
    val, err := m.GetBackingStore().Get("attestationEnforcement")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*AttestationEnforcement)
    }
    return nil
}
// GetFieldDeserializers the deserialization information for the current model
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful
func (m *PasskeyProfile) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
    res := m.Entity.GetFieldDeserializers()
    res["attestationEnforcement"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetEnumValue(ParseAttestationEnforcement)
        if err != nil {
            return err
        }
        if val != nil {
            m.SetAttestationEnforcement(val.(*AttestationEnforcement))
        }
        return nil
    }
    res["keyRestrictions"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetObjectValue(CreateFido2KeyRestrictionsFromDiscriminatorValue)
        if err != nil {
            return err
        }
        if val != nil {
            m.SetKeyRestrictions(val.(Fido2KeyRestrictionsable))
        }
        return nil
    }
    res["name"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetStringValue()
        if err != nil {
            return err
        }
        if val != nil {
            m.SetName(val)
        }
        return nil
    }
    res["passkeyTypes"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetEnumValue(ParsePasskeyTypes)
        if err != nil {
            return err
        }
        if val != nil {
            m.SetPasskeyTypes(val.(*PasskeyTypes))
        }
        return nil
    }
    return res
}
// GetKeyRestrictions gets the keyRestrictions property value. Controls whether key restrictions are enforced on passkeys (FIDO2), either allowing or disallowing certain key types as defined by Authenticator Attestation GUID (AAGUID), an identifier that indicates the type (for example, make and model) of the authenticator. Required.
// returns a Fido2KeyRestrictionsable when successful
func (m *PasskeyProfile) GetKeyRestrictions()(Fido2KeyRestrictionsable) {
    val, err := m.GetBackingStore().Get("keyRestrictions")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(Fido2KeyRestrictionsable)
    }
    return nil
}
// GetName gets the name property value. Name of the passkey profile. Required.
// returns a *string when successful
func (m *PasskeyProfile) GetName()(*string) {
    val, err := m.GetBackingStore().Get("name")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*string)
    }
    return nil
}
// GetPasskeyTypes gets the passkeyTypes property value. Specifies which types of passkeys are targeted in this passkey profile. Required. The possible values are: deviceBound, synced, unknownFutureValue.
// returns a *PasskeyTypes when successful
func (m *PasskeyProfile) GetPasskeyTypes()(*PasskeyTypes) {
    val, err := m.GetBackingStore().Get("passkeyTypes")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*PasskeyTypes)
    }
    return nil
}
// Serialize serializes information the current object
func (m *PasskeyProfile) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
    err := m.Entity.Serialize(writer)
    if err != nil {
        return err
    }
    if m.GetAttestationEnforcement() != nil {
        cast := (*m.GetAttestationEnforcement()).String()
        err = writer.WriteStringValue("attestationEnforcement", &cast)
        if err != nil {
            return err
        }
    }
    {
        err = writer.WriteObjectValue("keyRestrictions", m.GetKeyRestrictions())
        if err != nil {
            return err
        }
    }
    {
        err = writer.WriteStringValue("name", m.GetName())
        if err != nil {
            return err
        }
    }
    if m.GetPasskeyTypes() != nil {
        cast := (*m.GetPasskeyTypes()).String()
        err = writer.WriteStringValue("passkeyTypes", &cast)
        if err != nil {
            return err
        }
    }
    return nil
}
// SetAttestationEnforcement sets the attestationEnforcement property value. The attestationEnforcement property
func (m *PasskeyProfile) SetAttestationEnforcement(value *AttestationEnforcement)() {
    err := m.GetBackingStore().Set("attestationEnforcement", value)
    if err != nil {
        panic(err)
    }
}
// SetKeyRestrictions sets the keyRestrictions property value. Controls whether key restrictions are enforced on passkeys (FIDO2), either allowing or disallowing certain key types as defined by Authenticator Attestation GUID (AAGUID), an identifier that indicates the type (for example, make and model) of the authenticator. Required.
func (m *PasskeyProfile) SetKeyRestrictions(value Fido2KeyRestrictionsable)() {
    err := m.GetBackingStore().Set("keyRestrictions", value)
    if err != nil {
        panic(err)
    }
}
// SetName sets the name property value. Name of the passkey profile. Required.
func (m *PasskeyProfile) SetName(value *string)() {
    err := m.GetBackingStore().Set("name", value)
    if err != nil {
        panic(err)
    }
}
// SetPasskeyTypes sets the passkeyTypes property value. Specifies which types of passkeys are targeted in this passkey profile. Required. The possible values are: deviceBound, synced, unknownFutureValue.
func (m *PasskeyProfile) SetPasskeyTypes(value *PasskeyTypes)() {
    err := m.GetBackingStore().Set("passkeyTypes", value)
    if err != nil {
        panic(err)
    }
}
type PasskeyProfileable interface {
    Entityable
    i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
    GetAttestationEnforcement()(*AttestationEnforcement)
    GetKeyRestrictions()(Fido2KeyRestrictionsable)
    GetName()(*string)
    GetPasskeyTypes()(*PasskeyTypes)
    SetAttestationEnforcement(value *AttestationEnforcement)()
    SetKeyRestrictions(value Fido2KeyRestrictionsable)()
    SetName(value *string)()
    SetPasskeyTypes(value *PasskeyTypes)()
}
