import { z } from 'zod';
import { globalOptionsZod } from '../../../../Command.js';
import { entraGroup } from '../../../../utils/entraGroup.js';
import GraphCommand from '../../../base/GraphCommand.js';
import commands from '../../commands.js';
export const options = z.strictObject({
    ...globalOptionsZod.shape,
    id: z.uuid().optional().alias('i'),
    displayName: z.string().optional().alias('n'),
    properties: z.string().optional().alias('p')
});
class EntraGroupGetCommand extends GraphCommand {
    get name() {
        return commands.GROUP_GET;
    }
    get description() {
        return 'Gets information about the specified Entra group';
    }
    get schema() {
        return options;
    }
    getRefinedSchema(schema) {
        return schema
            .refine(options => [options.id, options.displayName].filter(o => o !== undefined).length === 1, {
            error: 'Use one of the following options: id or displayName.',
            params: {
                customCode: 'optionSet',
                options: ['id', 'displayName']
            }
        });
    }
    async commandAction(logger, args) {
        let group;
        try {
            if (args.options.id) {
                group = await entraGroup.getGroupById(args.options.id, args.options.properties);
            }
            else {
                group = await entraGroup.getGroupByDisplayName(args.options.displayName, args.options.properties);
            }
            await logger.log(group);
        }
        catch (err) {
            this.handleRejectedODataJsonPromise(err);
        }
    }
}
export default new EntraGroupGetCommand();
//# sourceMappingURL=group-get.js.map