module.exports = {
  root: true,
  ignorePatterns: ['**/*'],
  plugins: ['@nx'],
  extends: ['@react-native'],
  overrides: [
    {
      files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
      rules: {
        '@nx/enforce-module-boundaries': [
          'error',
          {
            enforceBuildableLibDependency: true,
            allow: [],
            depConstraints: [
              // Domain Purity: Domain layers can only depend on other domain layers or types
              {
                sourceTag: 'type:domain',
                onlyDependOnLibsWithTags: ['type:domain', 'type:types', 'scope:shared']
              },
              
              // Data layer can depend on domain and core infrastructure
              {
                sourceTag: 'type:data',
                onlyDependOnLibsWithTags: [
                  'type:domain', 
                  'type:types', 
                  'scope:core', 
                  'scope:shared'
                ]
              },
              
              // UI layer can depend on data and domain
              {
                sourceTag: 'type:ui',
                onlyDependOnLibsWithTags: [
                  'type:data', 
                  'type:domain', 
                  'type:types', 
                  'scope:shared'
                ]
              },
              
              // Platform-specific rules
              {
                sourceTag: 'platform:shared',
                notDependOnLibsWithTags: ['platform:rn', 'platform:node']
              },
              
              // Vertical isolation: Features cannot depend on other features
              {
                sourceTag: 'scope:feature',
                notDependOnLibsWithTags: ['scope:feature']
              },
              
              // Core SDKs can only depend on other core SDKs or shared
              {
                sourceTag: 'scope:core',
                onlyDependOnLibsWithTags: ['scope:core', 'scope:shared', 'type:types']
              }
            ]
          }
        ]
      }
    },
    {
      files: ['*.ts', '*.tsx'],
      extends: ['@nx/typescript'],
      rules: {
        '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
        '@typescript-eslint/explicit-function-return-type': 'warn'
      }
    },
    {
      files: ['*.js', '*.jsx'],
      extends: ['@nx/javascript'],
      rules: {}
    },
    {
      files: ['*.spec.ts', '*.spec.tsx', '*.spec.js', '*.spec.jsx'],
      env: {
        jest: true
      },
      rules: {}
    }
  ]
};