import { z } from 'zod';
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()
});
class EntraUserRecycleBinItemRestoreCommand extends GraphCommand {
    get name() {
        return commands.USER_RECYCLEBINITEM_RESTORE;
    }
    get description() {
        return 'Restores a user from the tenant recycle bin';
    }
    get schema() {
        return options;
    }
    async commandAction(logger, args) {
        if (this.verbose) {
            await logger.logToStderr(`Restoring user with id ${args.options.id} from the recycle bin.`);
        }
        try {
            const requestOptions = {
                url: `${this.resource}/v1.0/directory/deletedItems/${args.options.id}/restore`,
                headers: {
                    'content-type': 'application/json;odata.metadata=none'
                },
                responseType: 'json'
            };
            const user = await request.post(requestOptions);
            await logger.log(user);
        }
        catch (err) {
            this.handleRejectedODataJsonPromise(err);
        }
    }
}
export default new EntraUserRecycleBinItemRestoreCommand();
//# sourceMappingURL=user-recyclebinitem-restore.js.map