// 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 WhatIfAnalysisResult struct {
    ConditionalAccessPolicy
}
// NewWhatIfAnalysisResult instantiates a new WhatIfAnalysisResult and sets the default values.
func NewWhatIfAnalysisResult()(*WhatIfAnalysisResult) {
    m := &WhatIfAnalysisResult{
        ConditionalAccessPolicy: *NewConditionalAccessPolicy(),
    }
    return m
}
// CreateWhatIfAnalysisResultFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
// returns a Parsable when successful
func CreateWhatIfAnalysisResultFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
    return NewWhatIfAnalysisResult(), nil
}
// GetAnalysisReasons gets the analysisReasons property value. The analysisReasons property
// returns a *WhatIfAnalysisReasons when successful
func (m *WhatIfAnalysisResult) GetAnalysisReasons()(*WhatIfAnalysisReasons) {
    val, err := m.GetBackingStore().Get("analysisReasons")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*WhatIfAnalysisReasons)
    }
    return nil
}
// GetFieldDeserializers the deserialization information for the current model
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful
func (m *WhatIfAnalysisResult) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
    res := m.ConditionalAccessPolicy.GetFieldDeserializers()
    res["analysisReasons"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetEnumValue(ParseWhatIfAnalysisReasons)
        if err != nil {
            return err
        }
        if val != nil {
            m.SetAnalysisReasons(val.(*WhatIfAnalysisReasons))
        }
        return nil
    }
    res["policyApplies"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetBoolValue()
        if err != nil {
            return err
        }
        if val != nil {
            m.SetPolicyApplies(val)
        }
        return nil
    }
    return res
}
// GetPolicyApplies gets the policyApplies property value. Specifies whether the policy applies to the sign-in properties provided in the request body. If policyApplies is true, the policy applies to the sign-in based on the sign-in properties provided. If policyApplies is false, the policy doesn't apply to the sign-in based on the sign-in properties provided and the analysisReasons property is populated to show the reason for the policy not applying.
// returns a *bool when successful
func (m *WhatIfAnalysisResult) GetPolicyApplies()(*bool) {
    val, err := m.GetBackingStore().Get("policyApplies")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*bool)
    }
    return nil
}
// Serialize serializes information the current object
func (m *WhatIfAnalysisResult) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
    err := m.ConditionalAccessPolicy.Serialize(writer)
    if err != nil {
        return err
    }
    if m.GetAnalysisReasons() != nil {
        cast := (*m.GetAnalysisReasons()).String()
        err = writer.WriteStringValue("analysisReasons", &cast)
        if err != nil {
            return err
        }
    }
    {
        err = writer.WriteBoolValue("policyApplies", m.GetPolicyApplies())
        if err != nil {
            return err
        }
    }
    return nil
}
// SetAnalysisReasons sets the analysisReasons property value. The analysisReasons property
func (m *WhatIfAnalysisResult) SetAnalysisReasons(value *WhatIfAnalysisReasons)() {
    err := m.GetBackingStore().Set("analysisReasons", value)
    if err != nil {
        panic(err)
    }
}
// SetPolicyApplies sets the policyApplies property value. Specifies whether the policy applies to the sign-in properties provided in the request body. If policyApplies is true, the policy applies to the sign-in based on the sign-in properties provided. If policyApplies is false, the policy doesn't apply to the sign-in based on the sign-in properties provided and the analysisReasons property is populated to show the reason for the policy not applying.
func (m *WhatIfAnalysisResult) SetPolicyApplies(value *bool)() {
    err := m.GetBackingStore().Set("policyApplies", value)
    if err != nil {
        panic(err)
    }
}
type WhatIfAnalysisResultable interface {
    ConditionalAccessPolicyable
    i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
    GetAnalysisReasons()(*WhatIfAnalysisReasons)
    GetPolicyApplies()(*bool)
    SetAnalysisReasons(value *WhatIfAnalysisReasons)()
    SetPolicyApplies(value *bool)()
}
