import { z } from 'zod';
import { cli } from '../../../../cli/cli.js';
import { globalOptionsZod } from '../../../../Command.js';
import request from '../../../../request.js';
import GraphCommand from '../../../base/GraphCommand.js';
import commands from '../../commands.js';
export const options = z.strictObject({
    ...globalOptionsZod.shape,
    id: z.uuid(),
    force: z.boolean().optional().alias('f')
});
class EntraUserRecycleBinItemRemoveCommand extends GraphCommand {
    get name() {
        return commands.USER_RECYCLEBINITEM_REMOVE;
    }
    get description() {
        return 'Removes a user from the recycle bin in the current tenant';
    }
    get schema() {
        return options;
    }
    async commandAction(logger, args) {
        const clearRecycleBinItem = async () => {
            if (this.verbose) {
                await logger.logToStderr(`Permanently deleting user with id ${args.options.id} from Microsoft Entra ID`);
            }
            try {
                const requestOptions = {
                    url: `${this.resource}/v1.0/directory/deletedItems/${args.options.id}`,
                    headers: {}
                };
                await request.delete(requestOptions);
            }
            catch (err) {
                this.handleRejectedODataJsonPromise(err);
            }
        };
        if (args.options.force) {
            await clearRecycleBinItem();
        }
        else {
            const result = await cli.promptForConfirmation({ message: `Are you sure you want to permanently delete the user with id ${args.options.id}?` });
            if (result) {
                await clearRecycleBinItem();
            }
        }
    }
}
export default new EntraUserRecycleBinItemRemoveCommand();
//# sourceMappingURL=user-recyclebinitem-remove.js.map