v2/src/PSSailpointV2/Model/GetOrgSettings200ResponseApprovalConfig.ps1

#
# SailPoint SaaS API
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
# Version: 2.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER DaysTillEscalation
No description available.
.PARAMETER DaysBetweenReminders
No description available.
.PARAMETER MaxReminders
No description available.
.PARAMETER FallbackApprover
No description available.
.OUTPUTS

GetOrgSettings200ResponseApprovalConfig<PSCustomObject>
#>


function Initialize-V2GetOrgSettings200ResponseApprovalConfig {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [Int32]
        ${DaysTillEscalation},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [Int32]
        ${DaysBetweenReminders},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [Int32]
        ${MaxReminders},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FallbackApprover}
    )

    Process {
        'Creating PSCustomObject: PSSailpointV2 => V2GetOrgSettings200ResponseApprovalConfig' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        if ($null -eq $DaysTillEscalation) {
            throw "invalid value for 'DaysTillEscalation', 'DaysTillEscalation' cannot be null."
        }

        if ($null -eq $DaysBetweenReminders) {
            throw "invalid value for 'DaysBetweenReminders', 'DaysBetweenReminders' cannot be null."
        }

        if ($null -eq $MaxReminders) {
            throw "invalid value for 'MaxReminders', 'MaxReminders' cannot be null."
        }

        if ($null -eq $FallbackApprover) {
            throw "invalid value for 'FallbackApprover', 'FallbackApprover' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "daysTillEscalation" = ${DaysTillEscalation}
            "daysBetweenReminders" = ${DaysBetweenReminders}
            "maxReminders" = ${MaxReminders}
            "fallbackApprover" = ${FallbackApprover}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to GetOrgSettings200ResponseApprovalConfig<PSCustomObject>

.DESCRIPTION

Convert from JSON to GetOrgSettings200ResponseApprovalConfig<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

GetOrgSettings200ResponseApprovalConfig<PSCustomObject>
#>

function ConvertFrom-V2JsonToGetOrgSettings200ResponseApprovalConfig {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: PSSailpointV2 => V2GetOrgSettings200ResponseApprovalConfig' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in V2GetOrgSettings200ResponseApprovalConfig
        $AllProperties = ("daysTillEscalation", "daysBetweenReminders", "maxReminders", "fallbackApprover")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'daysTillEscalation' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "daysTillEscalation"))) {
            throw "Error! JSON cannot be serialized due to the required property 'daysTillEscalation' missing."
        } else {
            $DaysTillEscalation = $JsonParameters.PSobject.Properties["daysTillEscalation"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "daysBetweenReminders"))) {
            throw "Error! JSON cannot be serialized due to the required property 'daysBetweenReminders' missing."
        } else {
            $DaysBetweenReminders = $JsonParameters.PSobject.Properties["daysBetweenReminders"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "maxReminders"))) {
            throw "Error! JSON cannot be serialized due to the required property 'maxReminders' missing."
        } else {
            $MaxReminders = $JsonParameters.PSobject.Properties["maxReminders"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "fallbackApprover"))) {
            throw "Error! JSON cannot be serialized due to the required property 'fallbackApprover' missing."
        } else {
            $FallbackApprover = $JsonParameters.PSobject.Properties["fallbackApprover"].value
        }

        $PSO = [PSCustomObject]@{
            "daysTillEscalation" = ${DaysTillEscalation}
            "daysBetweenReminders" = ${DaysBetweenReminders}
            "maxReminders" = ${MaxReminders}
            "fallbackApprover" = ${FallbackApprover}
        }

        return $PSO
    }

}