/**
 * Rule: hasMany-shows-children-in-detail
 *
 * For every `hasMany` relationship on a model, the parent model's
 * detail view should surface the child collection (section,
 * collapsible, link, card — any visible reference will do for v1).
 *
 * Relationship shape can be either an explicit object or a shorthand
 * string: `posts: hasMany Post cascade`. The parser normalizes to
 * `{ name: 'posts', type: 'hasMany', target: 'Post' }`.
 *
 * One TestCase per (parent-model, hasMany-relationship) pair.
 */
export const RULE_ID = 'hasMany-shows-children-in-detail';
export const hasManyShowsChildrenInDetail = (spec) => {
    const cases = [];
    for (const model of spec.models) {
        const rels = model.relationships || [];
        for (const rel of rels) {
            // Type may contain modifiers (e.g. 'hasMany cascade'); look
            // for the substring.
            const typeStr = String(rel.type || '');
            if (!/hasMany/i.test(typeStr))
                continue;
            cases.push({
                ruleId: RULE_ID,
                specElement: `${model.name}.${rel.name}`,
                name: `[${RULE_ID}] ${model.name}.${rel.name} relationship is visible in the detail view`,
                steps: [
                    { action: 'bootRuntime' },
                    { action: 'navigateToModelDetail', modelName: model.name },
                    { action: 'expectRelationshipSection', modelName: model.name, relationshipName: rel.name },
                ],
            });
        }
    }
    return cases;
};
//# sourceMappingURL=hasmany-shows-children-in-detail.js.map