import {
  AuthenticatedCommand
} from "./chunk-G2JISDKX.js";
import {
  require_lib
} from "./chunk-XECLOG6B.js";
import {
  require_source
} from "./chunk-M5OAS5QZ.js";
import {
  __toESM,
  init_cjs_shims
} from "./chunk-7GH3YGSC.js";

// src/commands/delete-schema.ts
init_cjs_shims();
var import_core = __toESM(require_lib(), 1);
var import_chalk = __toESM(require_source(), 1);
var DeleteSchema = class extends AuthenticatedCommand {
  static {
    this.summary = "Delete a Schema.";
  }
  static {
    this.description = `This mirrors the ${import_chalk.default.magentaBright(
      "deleteSchema"
    )} mutation in the GraphQL API.`;
  }
  static {
    this.examples = ["<%= config.bin %> <%= command.id %>"];
  }
  static {
    this.flags = {
      key: import_core.Flags.string({
        char: "k",
        description: `Key of the Schema to delete (e.g. template-schema).`,
        required: true
      })
    };
  }
  async run() {
    const res = await this.sdk.DeleteSchema({
      schema: {
        key: this.flags.key
      }
    });
    if (res.deleteSchema.__typename !== "DeleteSchemaResult") {
      this.logToStderr(`Received error: ${res.deleteSchema.__typename}`);
      this.logToStderr(`Message: ${res.deleteSchema.message}`);
      this.logToStderr(`Code: ${res.deleteSchema.code}`);
      this.logToStderr(`Retryable: ${res.deleteSchema.retryable}`);
      this.exit(1);
    }
  }
};

export {
  DeleteSchema
};
