reminder-escalations/src/PSSailpoint.ReminderEscalations/Model/Reminderescalationreminder.ps1

#
# SailPoint Identity Security API - Reminder Escalations
# Use these APIs to interact with the SailPoint Identity Security platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
# Version: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

One reminder schedule. Exactly one of `beforeDeadLine` or `activeAfter` is set. Every reminder in a ruleset must use the same predicate.

.PARAMETER Cron
Five-field cron expression, evaluated in UTC.
.PARAMETER BeforeDeadLine
ISO-8601 duration. The reminder is active when `(deadline - now) <= beforeDeadLine`. A negative duration means the reminder starts after the deadline, for example `-P14D`. Mutually exclusive with `activeAfter`.
.PARAMETER ActiveAfter
ISO-8601 duration. The reminder is active when `(now - workflowStart) >= activeAfter`. Mutually exclusive with `beforeDeadLine`.
.PARAMETER Template
Notification template key.
.PARAMETER MaxFirings
Maximum number of times this reminder fires before it deactivates. Null means the reminder keeps firing while its predicate is active.
.OUTPUTS

Reminderescalationreminder<PSCustomObject>
#>


function Initialize-Reminderescalationreminder {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Cron},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${BeforeDeadLine} = "",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActiveAfter} = "",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Template},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${MaxFirings}
    )

    Process {
        'Creating PSCustomObject: PSSailpoint.ReminderEscalations => Reminderescalationreminder' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        if (!$Cron) {
            throw "invalid value for 'Cron', 'Cron' cannot be null."
        }

        if (!$Template) {
            throw "invalid value for 'Template', 'Template' cannot be null."
        }

        if ($MaxFirings -and $MaxFirings -lt 1) {
          throw "invalid value for 'MaxFirings', must be greater than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "cron" = ${Cron}
            "beforeDeadLine" = ${BeforeDeadLine}
            "activeAfter" = ${ActiveAfter}
            "template" = ${Template}
            "maxFirings" = ${MaxFirings}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Reminderescalationreminder<PSCustomObject>

.DESCRIPTION

Convert from JSON to Reminderescalationreminder<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Reminderescalationreminder<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: PSSailpoint.ReminderEscalations => Reminderescalationreminder' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Reminderescalationreminder
        $AllProperties = ("cron", "beforeDeadLine", "activeAfter", "template", "maxFirings")
        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 'cron' missing."
        }

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "beforeDeadLine"))) { #optional property not found
            $BeforeDeadLine = $null
        } else {
            $BeforeDeadLine = $JsonParameters.PSobject.Properties["beforeDeadLine"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "activeAfter"))) { #optional property not found
            $ActiveAfter = $null
        } else {
            $ActiveAfter = $JsonParameters.PSobject.Properties["activeAfter"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "maxFirings"))) { #optional property not found
            $MaxFirings = $null
        } else {
            $MaxFirings = $JsonParameters.PSobject.Properties["maxFirings"].value
        }

        $PSO = [PSCustomObject]@{
            "cron" = ${Cron}
            "beforeDeadLine" = ${BeforeDeadLine}
            "activeAfter" = ${ActiveAfter}
            "template" = ${Template}
            "maxFirings" = ${MaxFirings}
        }

        return $PSO
    }

}