Model/DeleteProfiles200Response.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 Json

JSON object

.OUTPUTS

DeleteProfiles200Response<PSCustomObject>
#>

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

    Process {
        $match = 0
        $matchType = $null
        $matchInstance = $null

        # try to match Job defined in the oneOf schemas
        try {
            $matchInstance = ConvertFrom-NERMJsonToJob $Json

            foreach($property in $matchInstance.PsObject.Properties) {
                if ($null -ne $property.Value) {
                    $matchType = "Job"
                    $match++
                    break
                }
            }
        } catch {
            # fail to match the schema defined in oneOf, proceed to the next one
            Write-Debug "Failed to match 'Job' defined in oneOf (NERMDeleteProfiles200Response). Proceeding to the next one if any."
        }

        # try to match Profiles defined in the oneOf schemas
        try {
            $matchInstance = ConvertFrom-NERMJsonToProfiles $Json

            foreach($property in $matchInstance.PsObject.Properties) {
                if ($null -ne $property.Value) {
                    $matchType = "Profiles"
                    $match++
                    break
                }
            }
        } catch {
            # fail to match the schema defined in oneOf, proceed to the next one
            Write-Debug "Failed to match 'Profiles' defined in oneOf (NERMDeleteProfiles200Response). Proceeding to the next one if any."
        }

        if ($match -gt 1) {
            throw "Error! The JSON payload matches more than one type defined in oneOf schemas ([Job, Profiles]). JSON Payload: $($Json)"
        } elseif ($match -eq 1) {
            return [PSCustomObject]@{
                "ActualType" = ${matchType}
                "ActualInstance" = ${matchInstance}
                "OneOfSchemas" = @("Job", "Profiles")
            }
        } else {
            throw "Error! The JSON payload doesn't matches any type defined in oneOf schemas ([Job, Profiles]). JSON Payload: $($Json)"
        }
    }
}