Public/PayRates/Update-AspirePayRate.ps1

<#
.SYNOPSIS
    Updates an existing pay rate in the Aspire API.
.DESCRIPTION
    Uses Invoke-AspireRequest to perform a PUT request to the /PayRates endpoint.
.PARAMETER PayRateID
    The ID of the pay rate to update (required).
.PARAMETER ContactID
    The contact ID (required).
.PARAMETER EffectiveDate
    The effective date (required, date-time).
.PARAMETER BurdenPercent
    The burden percent (required, decimal).
.PARAMETER HourlyBasePay
    Optional hourly base pay (decimal).
.OUTPUTS
    The response from the API containing the updated pay rate details.
.EXAMPLE
    Update-AspirePayRate -PayRateID 1 -ContactID 1 -EffectiveDate "2023-01-01T00:00:00" -BurdenPercent 10.0
#>

function Update-AspirePayRate {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [int]$PayRateID,
        [Parameter(Mandatory = $true)]
        [int]$ContactID,
        [Parameter(Mandatory = $true)]
        [string]$EffectiveDate,
        [Parameter(Mandatory = $true)]
        [decimal]$BurdenPercent,
        [decimal]$HourlyBasePay = $null
    )

    $body = @{
        PayRateID = $PayRateID
        ContactID = $ContactID
        EffectiveDate = $EffectiveDate
        BurdenPercent = $BurdenPercent
    }

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

    return Invoke-AspireRequest -Method PUT -Path "/PayRates" -Body $body -ApiVersion $null
}