/**
 * Rule: action-buttons-present
 *
 * For every CURED operation supported by a controller, the
 * corresponding model's view should expose a visible action trigger
 * (button, menu item, etc.) labeled with the operation name.
 *
 * CURED = create / update / retrieve / validate / evolve / delete.
 * The spec declares which ones a controller supports via
 * `cured: { create: {}, retrieve: {}, ... }`.
 *
 * v1 looks for operation labels as visible text. A stricter
 * variant could use `getByRole('button', { name })` once the
 * runtime's button markup stabilizes.
 *
 * One TestCase per (controller, cured-operation) pair.
 */
export const RULE_ID = 'action-buttons-present';
/**
 * Canonical CURED labels. Used both as the trigger text to search for
 * AND as the keys inside `controller.cured`. If a controller declares
 * a custom action, we'll pick it up too via the Object.keys iteration
 * below — this set just records which labels are considered canonical.
 */
const CURED_LABELS = new Set([
    'create',
    'retrieve',
    'update',
    'validate',
    'evolve',
    'delete',
]);
export const actionButtonsPresent = (spec) => {
    const cases = [];
    for (const controller of spec.controllers || []) {
        const cured = controller.cured;
        if (!cured)
            continue;
        const modelName = controller.model || controller.name.replace(/Controller$/, '');
        for (const opName of Object.keys(cured)) {
            // Skip the common 'retrieve' and 'validate' which typically
            // don't have their own button (they fire implicitly). Keep
            // create/update/delete/evolve — the ones users trigger.
            if (!CURED_LABELS.has(opName))
                continue;
            if (opName === 'retrieve' || opName === 'validate')
                continue;
            cases.push({
                ruleId: RULE_ID,
                specElement: `${controller.name}.${opName}`,
                name: `[${RULE_ID}] ${modelName}.${opName} action button is visible`,
                steps: [
                    { action: 'bootRuntime' },
                    { action: 'navigateToModel', modelName },
                    { action: 'expectActionButton', modelName, actionLabel: opName },
                ],
            });
        }
    }
    return cases;
};
//# sourceMappingURL=action-buttons-present.js.map