Public/Companies/Update-AspireCompany.ps1

<#
.SYNOPSIS
    Updates an existing company in the Aspire API.
.DESCRIPTION
    Uses Invoke-AspireRequest to perform a PUT request to the /Companies endpoint.
.PARAMETER CompanyID
    The ID of the company to update (required).
.PARAMETER CompanyName
    The name of the company (required).
.PARAMETER DeniedTimeEmail
    Optional email for denied time notifications.
.PARAMETER Active
    Optional boolean indicating if the company is active.
.OUTPUTS
    The response from the API containing the updated company details.
.EXAMPLE
    Update-AspireCompany -CompanyID 1 -CompanyName "Updated Company" -Active $false
#>

function Update-AspireCompany {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [int]$CompanyID,
        [Parameter(Mandatory = $true)]
        [string]$CompanyName,
        [string]$DeniedTimeEmail = $null,
        [bool]$Active = $null
    )

    $body = @{
        CompanyID = $CompanyID
        CompanyName = $CompanyName
    }

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

    if ($Active -ne $null) {
        $body.Active = $Active
    }

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