import { z } from 'zod';
import { createCommand } from "../../../types.js";
import * as tui from "../../../tui.js";
import { createScheduleAdapter } from "./util.js";
import { getCommand } from "../../../command-prefix.js";
const ScheduleDeleteResponseSchema = z.object({
    success: z.boolean(),
    schedule_id: z.string(),
});
export const deleteSubcommand = createCommand({
    name: 'delete',
    aliases: ['rm', 'del', 'remove', 'terminate'],
    description: 'Delete a schedule',
    tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
    requires: { auth: true },
    idempotent: true,
    examples: [
        {
            command: getCommand('cloud schedule delete sched_abc123'),
            description: 'Delete a schedule',
        },
    ],
    schema: {
        args: z.object({
            schedule_id: z.string().min(1).describe('Schedule ID'),
        }),
        response: ScheduleDeleteResponseSchema,
    },
    async handler(ctx) {
        const { args, options } = ctx;
        const schedule = await createScheduleAdapter(ctx);
        await schedule.delete(args.schedule_id);
        if (!options.json) {
            tui.success(`Deleted schedule: ${args.schedule_id}`);
        }
        return { success: true, schedule_id: args.schedule_id };
    },
});
//# sourceMappingURL=delete.js.map