Model/Profile1.ps1

#
# NERM API
# The NERM API 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 Name
The profile name.
.PARAMETER ProfileTypeId
The profile type id.
.PARAMETER Status
The profile status.
.PARAMETER IdProofingStatus
The id proofing status of the profile.
.PARAMETER Archived
Describes whether the profile is archived or not.
.PARAMETER Attributes
The attributes associated with the profile.
.OUTPUTS

Profile1<PSCustomObject>
#>


function Initialize-NERMProfile1 {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProfileTypeId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Active", "Inactive", "On Leave", "Terminated")]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("pending", "pass", "fail")]
        [String]
        ${IdProofingStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Archived} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes}
    )

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

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

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "profile_type_id" = ${ProfileTypeId}
            "status" = ${Status}
            "id_proofing_status" = ${IdProofingStatus}
            "archived" = ${Archived}
            "attributes" = ${Attributes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Profile1<PSCustomObject>

.DESCRIPTION

Convert from JSON to Profile1<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Profile1<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMProfile1
        $AllProperties = ("name", "profile_type_id", "status", "id_proofing_status", "archived", "attributes")
        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 'profile_type_id' missing."
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "profile_type_id" = ${ProfileTypeId}
            "status" = ${Status}
            "id_proofing_status" = ${IdProofingStatus}
            "archived" = ${Archived}
            "attributes" = ${Attributes}
        }

        return $PSO
    }

}