Public/TaxJurisdictions/New-AspireTaxJurisdictions.ps1

<#
.SYNOPSIS
    Creates a new tax jurisdiction in the Aspire API.
.DESCRIPTION
    Uses Invoke-AspireRequest to perform a POST request to the /TaxJurisdictions endpoint.
.PARAMETER TaxJurisdictionName
    The name of the tax jurisdiction (required).
.PARAMETER FederalTaxPercent
    The federal tax percentage (optional).
.PARAMETER Active
    Whether the tax jurisdiction is active (required).
.PARAMETER TaxEntityJurisdictions
    Array of tax entity jurisdiction IDs (optional).
.OUTPUTS
    The response from the API containing the result.
.EXAMPLE
    New-AspireTaxJurisdictions -TaxJurisdictionName "CA" -Active $true
#>

function New-AspireTaxJurisdictions {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$TaxJurisdictionName,
        [decimal]$FederalTaxPercent = $null,
        [Parameter(Mandatory = $true)]
        [bool]$Active,
        [int[]]$TaxEntityJurisdictions = $null
    )

    $body = @{
        TaxJurisdictionName = $TaxJurisdictionName
        Active = $Active
    }

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

    return Invoke-AspireRequest -Method POST -Path "/TaxJurisdictions" -Body $body
}