import { captureEvent } from "../common/analytics/lib.js";
import { authenticate } from "../common/middleware/authentication.js";
import { configure } from "../common/middleware/user-configuration.js";
import { identify } from "../common/middleware/user-identification.js";
import setBlocking from "../common/output.js";
import { deleteZup } from "../delete/handler.js";
import { fetchAccount } from "../common/middleware/get-account-param.js";
import { fetchProject } from "../common/middleware/get-project-param.js";
export default {
    desc: "Deletes the Zuplo API at the URL",
    command: "delete",
    builder: (yargs) => {
        return yargs
            .option("api-key", {
            type: "string",
            describe: "The API Key from Zuplo",
            envVar: "API_KEY",
        })
            .option("url", {
            type: "string",
            describe: "The URL of the Zuplo API to delete",
        })
            .option("project", {
            type: "string",
            describe: "The project name",
        })
            .option("account", {
            type: "string",
            describe: "The account name",
        })
            .option("wait", {
            type: "boolean",
            describe: "Should the CLI wait until the Zuplo API is deleted",
        })
            .option("self-hosted-endpoint", {
            type: "string",
            describe: "The endpoint of your self-hosted service to deploy to",
        })
            .boolean("wait")
            .demandOption(["url"])
            .middleware([
            setBlocking,
            authenticate,
            configure,
            fetchAccount,
            fetchProject,
            identify,
        ]);
    },
    handler: async (argv) => {
        await captureEvent({ argv, event: "zuplo delete" });
        await deleteZup(argv);
    },
};
//# sourceMappingURL=delete.js.map