Private/ps1/Remove-ApprxrFileWatcherLocationEntry.ps1

<##
.SYNOPSIS
    Removes a file watcher location entry from the Apprxr configuration.
.DESCRIPTION
    Deletes the specified location entry by name from the 'FileWatcher' configuration value and updates the JSON.
.PARAMETER Name
    The unique name for the location setting to remove.
.EXAMPLE
    Remove-ApprxrFileWatcherLocationEntry -Name 'Location1'
    Removes the entry for 'Location1' from the file watcher configuration.
##>

function Remove-ApprxrFileWatcherLocationEntry {
    param(
        [Parameter(Mandatory)]
        [string]$Name
    )
    $locations = Get-ApprxrFileWatcherLocations
    if ($locations.ContainsKey($Name)) {
        $locations.Remove($Name)
        Log "Removed file watcher location: $Name"
        $json = $locations | ConvertTo-Json -Depth 5
        Set-ApprxrConfigurationValue -Name 'FileWatcher' -Value $json
    } else {
        Log "File watcher location not found: $Name"
    }
}