module.exports = {
  meta: {
    type: 'problem',
    docs: {
      description: 'Ban index.ts files in Core - use explicit imports instead',
      category: 'Best Practices',
      recommended: true,
    },
    fixable: null,
    schema: [],
    messages: {
      indexFile: 'Index files are banned in core. Use explicit imports. Example: Instead of "import { foo } from "./", use "import { foo } from "./foo".',
    },
  },

  create(context) {
    const filename = context.getFilename();
    const isIndexFile = /(^|\/|\\)index\.ts$/.test(filename);
    
    // Allow root index.ts if any
    const allowedPaths = [
      'core/index.ts',
    ];
    
    if (isIndexFile && !allowedPaths.some(path => filename.endsWith(path))) {
      context.report({
        node: null,
        loc: { line: 1, column: 0 },
        messageId: 'indexFile',
      });
    }
    
    return {};
  },
};
