#
# Echo Server API
# Echo Server API
# Version: 0.1.0
# Contact: team@openapitools.org
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Id
Query
.PARAMETER Outcomes
No description available.
.OUTPUTS

Query<PSCustomObject>
#>

function Initialize-Query {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SUCCESS", "FAILURE", "SKIPPED")]
        [String[]]
        ${Outcomes}
    )

    Process {
        'Creating PSCustomObject: PSOpenAPITools => Query' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "outcomes" = ${Outcomes}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Query<PSCustomObject>

.DESCRIPTION

Convert from JSON to Query<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Query<PSCustomObject>
#>
function ConvertFrom-JsonToQuery {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: PSOpenAPITools => Query' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Query
        $AllProperties = ("id", "outcomes")
        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 "outcomes"))) { #optional property not found
            $Outcomes = $null
        } else {
            $Outcomes = $JsonParameters.PSobject.Properties["outcomes"].value
        }

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "outcomes" = ${Outcomes}
        }

        return $PSO
    }

}

