Model/ProfileType1.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
This is the name of the profile type.
.PARAMETER Category
This is the category the profile type falls into.
.PARAMETER BypassDupProtection
Whether or not duplication protection is bypassed.
.PARAMETER Archived
Whether or not the profile type is archived.
.PARAMETER PermittedRoleIds
The role ids that are permitted for this profile type.
.PARAMETER IscSynced
Is this profile type synced with ics
.PARAMETER ProfileTypeDupAttributesAttributes
No description available.
.PARAMETER ProfileTypeNamingsAttributes
No description available.
.OUTPUTS

ProfileType1<PSCustomObject>
#>


function Initialize-NERMProfileType1 {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("employee", "non-employee", "organization", "assignment", "other")]
        [String]
        ${Category},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${BypassDupProtection} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Archived} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${PermittedRoleIds},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IscSynced} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ProfileTypeDupAttributesAttributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ProfileTypeNamingsAttributes}
    )

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "category" = ${Category}
            "bypass_dup_protection" = ${BypassDupProtection}
            "archived" = ${Archived}
            "permitted_role_ids" = ${PermittedRoleIds}
            "isc_synced" = ${IscSynced}
            "profile_type_dup_attributes_attributes" = ${ProfileTypeDupAttributesAttributes}
            "profile_type_namings_attributes" = ${ProfileTypeNamingsAttributes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ProfileType1<PSCustomObject>

.DESCRIPTION

Convert from JSON to ProfileType1<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ProfileType1<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMProfileType1
        $AllProperties = ("name", "category", "bypass_dup_protection", "archived", "permitted_role_ids", "isc_synced", "profile_type_dup_attributes_attributes", "profile_type_namings_attributes")
        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 "name"))) { #optional property not found
            $Name = $null
        } else {
            $Name = $JsonParameters.PSobject.Properties["name"].value
        }

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "bypass_dup_protection"))) { #optional property not found
            $BypassDupProtection = $null
        } else {
            $BypassDupProtection = $JsonParameters.PSobject.Properties["bypass_dup_protection"].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 "permitted_role_ids"))) { #optional property not found
            $PermittedRoleIds = $null
        } else {
            $PermittedRoleIds = $JsonParameters.PSobject.Properties["permitted_role_ids"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "category" = ${Category}
            "bypass_dup_protection" = ${BypassDupProtection}
            "archived" = ${Archived}
            "permitted_role_ids" = ${PermittedRoleIds}
            "isc_synced" = ${IscSynced}
            "profile_type_dup_attributes_attributes" = ${ProfileTypeDupAttributesAttributes}
            "profile_type_namings_attributes" = ${ProfileTypeNamingsAttributes}
        }

        return $PSO
    }

}