Model/CreateResourceMailboxBookingOptionRequestModel.ps1

#
# Cloud Governance Api
# Contact: support@avepoint.com
#

<#
CreateResourceMailboxBookingOptionRequestModel<PSCustomObject>
#>


function New-CreateResourceMailboxBookingOptionRequestModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsAllowRepeatedMeetings} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsAllowScheduOnlyDuringWorkerHours} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AutoReplyMessage},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsAutoDecline} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${BookingWindowDays},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${MaxDurationHours},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

    Process {
        'Creating PSCustomObject: Cloud.Governance.Client => CreateResourceMailboxBookingOptionRequestModel' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "IsAllowRepeatedMeetings" = ${IsAllowRepeatedMeetings}
            "IsAllowScheduOnlyDuringWorkerHours" = ${IsAllowScheduOnlyDuringWorkerHours}
            "AutoReplyMessage" = ${AutoReplyMessage}
            "IsAutoDecline" = ${IsAutoDecline}
            "BookingWindowDays" = ${BookingWindowDays}
            "MaxDurationHours" = ${MaxDurationHours}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
CreateResourceMailboxBookingOptionRequestModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CreateResourceMailboxBookingOptionRequestModel
        $AllProperties = $("IsAllowRepeatedMeetings", "IsAllowScheduOnlyDuringWorkerHours", "AutoReplyMessage", "IsAutoDecline", "BookingWindowDays", "MaxDurationHours", "ActivityId")
        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 "IsAllowRepeatedMeetings"))) { #optional property not found
            $IsAllowRepeatedMeetings = $null
        } else {
            $IsAllowRepeatedMeetings = $JsonParameters.PSobject.Properties["IsAllowRepeatedMeetings"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "IsAllowRepeatedMeetings" = ${IsAllowRepeatedMeetings}
            "IsAllowScheduOnlyDuringWorkerHours" = ${IsAllowScheduOnlyDuringWorkerHours}
            "AutoReplyMessage" = ${AutoReplyMessage}
            "IsAutoDecline" = ${IsAutoDecline}
            "BookingWindowDays" = ${BookingWindowDays}
            "MaxDurationHours" = ${MaxDurationHours}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}