Model/Delegation1.ps1

#
# NERM API v2025
# The NERM API v2025 accesss and modifies resources in your environment.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Id
The id of the delegation
.PARAMETER DelegatorId
The id of the delegator user
.PARAMETER DelegateId
The id of the delegate user
.PARAMETER Expiration
The expiration date of the delegation
.PARAMETER Expired
Indicates if the delegation is expired
.OUTPUTS

Delegation1<PSCustomObject>
#>


function Initialize-NERMV2025Delegation1 {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${DelegatorId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${DelegateId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Expiration},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Expired}
    )

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "delegator_id" = ${DelegatorId}
            "delegate_id" = ${DelegateId}
            "expiration" = ${Expiration}
            "expired" = ${Expired}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Delegation1<PSCustomObject>

.DESCRIPTION

Convert from JSON to Delegation1<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Delegation1<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMV2025Delegation1
        $AllProperties = ("id", "delegator_id", "delegate_id", "expiration", "expired", "created_at", "updated_at")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "delegator_id" = ${DelegatorId}
            "delegate_id" = ${DelegateId}
            "expiration" = ${Expiration}
            "expired" = ${Expired}
            "created_at" = ${CreatedAt}
            "updated_at" = ${UpdatedAt}
        }

        return $PSO
    }

}