/**
 * ESLint rules for Model Taxonomy Guardrails
 * 
 * Enforces model classification boundaries
 */

module.exports = {
  // Rule 1: No domain models in display objects
  'no-domain-models-in-display-objects': {
    meta: {
      type: 'problem',
      docs: {
        description: 'Forbid domain models in display objects',
        category: 'Model Taxonomy',
      },
      messages: {
        message: 'Display objects cannot contain domain models - see apps/website/lib/contracts/view-models/ViewModel.ts',
      },
    },
    create(context) {
      return {
        ImportDeclaration(node) {
          const filename = context.getFilename();
          if (filename.includes('/lib/display-objects/')) {
            const importPath = node.source.value;
            
            // Check for domain model imports
            if (importPath.includes('@/lib/domain/') ||
                importPath.includes('@/lib/models/') ||
                importPath.includes('Entity') ||
                importPath.includes('Aggregate')) {
              context.report({
                node,
                messageId: 'message',
              });
            }
          }
        },
      };
    },
  },

  // Rule 2: No display objects in domain models
  'no-display-objects-in-domain-models': {
    meta: {
      type: 'problem',
      docs: {
        description: 'Forbid display objects in domain models',
        category: 'Model Taxonomy',
      },
      messages: {
        message: 'Domain models cannot contain display objects - see apps/website/lib/contracts/view-models/ViewModel.ts',
      },
    },
    create(context) {
      return {
        ImportDeclaration(node) {
          const filename = context.getFilename();
          if (filename.includes('/lib/domain/') || 
              filename.includes('/lib/models/')) {
            const importPath = node.source.value;
            
            // Check for display object imports
            if (importPath.includes('@/lib/display-objects/') ||
                importPath.includes('Component') ||
                importPath.includes('View')) {
              context.report({
                node,
                messageId: 'message',
              });
            }
          }
        },
      };
    },
  },
};