import { logger } from "../../common/logger.js";
import { printDiagnosticsToConsole, printResultToConsoleAndExitGracefully, textOrJson, } from "../../common/output.js";
import settings from "../../common/settings.js";
export async function deleteProxyConfiguration(argv) {
    const { account, fleet } = argv;
    const deleteResponse = await fetch(`${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/accounts/${account}/fleets/${fleet}/proxy-configuration`, {
        method: "DELETE",
        headers: {
            Authorization: `Bearer ${argv.authToken}`,
        },
    });
    if (deleteResponse.ok) {
        await printResultToConsoleAndExitGracefully(`Proxy configuration for fleet ${fleet} deleted successfully.`);
    }
    else {
        const response = textOrJson(await deleteResponse.text());
        logger.error({
            status: deleteResponse.status,
            statusText: deleteResponse.statusText,
            response,
        }, "Failed to delete proxy configuration");
        printDiagnosticsToConsole("Error: Failed to delete proxy configuration. Check the arguments.", response);
        process.exit(1);
    }
}
//# sourceMappingURL=handler.js.map