Model/MicrosoftODataEdmVocabulariesIEdmTerm.ps1

#
# Portal Api
# Portal Api HTTP API V1
# Version: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS
 
No summary available.
 
.DESCRIPTION
 
No description available.
 
.PARAMETER Type
No description available.
.PARAMETER SchemaElementKind
No description available.
.OUTPUTS
 
MicrosoftODataEdmVocabulariesIEdmTerm<PSCustomObject>
#>


function Initialize-ElementsMicrosoftODataEdmVocabulariesIEdmTerm {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("0", "1", "2", "3", "4", "5")]
        [PSCustomObject]
        ${SchemaElementKind}
    )

    Process {
        'Creating PSCustomObject: Elements.Client => ElementsMicrosoftODataEdmVocabulariesIEdmTerm' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "schemaElementKind" = ${SchemaElementKind}
        }

        return $PSO
    }
}

<#
.SYNOPSIS
 
Convert from JSON to MicrosoftODataEdmVocabulariesIEdmTerm<PSCustomObject>
 
.DESCRIPTION
 
Convert from JSON to MicrosoftODataEdmVocabulariesIEdmTerm<PSCustomObject>
 
.PARAMETER Json
 
Json object
 
.OUTPUTS
 
MicrosoftODataEdmVocabulariesIEdmTerm<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: Elements.Client => ElementsMicrosoftODataEdmVocabulariesIEdmTerm' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ElementsMicrosoftODataEdmVocabulariesIEdmTerm
        $AllProperties = ("type", "appliesTo", "defaultValue", "schemaElementKind", "namespace", "name")
        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 "type"))) { #optional property not found
            $Type = $null
        } else {
            $Type = $JsonParameters.PSobject.Properties["type"].value
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "appliesTo" = ${AppliesTo}
            "defaultValue" = ${DefaultValue}
            "schemaElementKind" = ${SchemaElementKind}
            "namespace" = ${Namespace}
            "name" = ${Name}
        }

        return $PSO
    }

}