Public/PropertyAvailabilities/New-AspirePropertyAvailability.ps1

<#
.SYNOPSIS
    Creates a new property availability in the Aspire API.
.DESCRIPTION
    Uses Invoke-AspireRequest to perform a POST request to the /PropertyAvailabilities endpoint.
.PARAMETER PropertyId
    The ID of the property (required).
.PARAMETER AvailabilityTimes
    Optional array of availability time objects. Each object should have properties: DayOfWeek (int 0-6), StartTime (string), EndTime (string).
.OUTPUTS
    The response from the API containing the result.
.EXAMPLE
    $times = @(
        @{ DayOfWeek = 1; StartTime = "08:00:00"; EndTime = "17:00:00" }
    )
    New-AspirePropertyAvailability -PropertyId 123 -AvailabilityTimes $times
#>

function New-AspirePropertyAvailability {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [int]$PropertyId,
        [hashtable[]]$AvailabilityTimes = $null
    )

    $body = @{
        PropertyId = $PropertyId
    }

    if ($AvailabilityTimes) {
        $body.AvailabilityTimes = $AvailabilityTimes
    }

    return Invoke-AspireRequest -Method POST -Path "/PropertyAvailabilities" -Body $body -ApiVersion $null
}