{
  "ai_optimization": {
    "name": "PraFrota AI Context Optimization",
    "version": "1.0.0",
    "description": "Contexto otimizado para IA com informações específicas do projeto",
    
    "primary_references": {
      "perfect_template": "projects/idt_app/src/app/domain/drivers/drivers.component.ts",
      "architecture_guide": ".mcp/config.json",
      "development_rules": ".cursorrules",
      "project_documentation": "projects/idt_app/docs/general/CURSOR.md"
    },

    "quick_context": {
      "framework": "Angular 19.2.x",
      "language": "TypeScript 5.5.x",
      "node_version": "20.x",
      "architecture": "Standalone Components + BaseDomainComponent",
      "state_management": "RxJS Observables (NO NgRx)",
      "ui_library": "Angular Material + Custom Components"
    },

    "mandatory_patterns": {
      "components": {
        "type": "standalone",
        "inheritance": "BaseDomainComponent for ERP domains",
        "naming": "kebab-case files, PascalCase classes",
        "structure": ["component.ts", "component.html", "component.scss"]
      },
      "services": {
        "injection": "providedIn: 'root'",
        "return_type": "Observable<T>",
        "http_client": "required for API calls",
        "suffix": "Service"
      },
      "interfaces": {
        "naming": "PascalCase",
        "suffix": ".interface.ts",
        "export": "named export"
      },
      "forms": {
        "type": "reactive_forms_only",
        "builder": "FormBuilder",
        "validation": "Angular Validators"
      }
    },

    "code_templates": {
      "component_standalone": {
        "decorator": "@Component({ selector: 'app-name', standalone: true, imports: [...] })",
        "class": "export class NameComponent { }",
        "imports": ["CommonModule", "ReactiveFormsModule"]
      },
      "service_injectable": {
        "decorator": "@Injectable({ providedIn: 'root' })",
        "constructor": "constructor(private http: HttpClient) {}",
        "method": "getData(): Observable<DataType[]> { return this.http.get<DataType[]>('/api/endpoint'); }"
      },
      "interface_definition": {
        "structure": "export interface DataType { id: number; name: string; status: 'active' | 'inactive'; }",
        "location": "shared/interfaces/ or domain specific"
      }
    },

    "shared_components": {
      "data_table": {
        "path": "shared/components/data-table/",
        "purpose": "Reusable table with pagination, filters, sorting",
        "key_features": ["server-side pagination", "column configuration", "custom actions"]
      },
      "tab_system": {
        "path": "shared/components/tab-system/", 
        "purpose": "Form tabs for complex data entry",
        "integration": "works with BaseDomainComponent"
      },
      "base_domain": {
        "path": "shared/components/base-domain/",
        "purpose": "Base class for ERP domains",
        "configuration": "getDomainConfig() method"
      }
    },

    "api_integrations": {
      "prafrota_backend": {
        "base_url": "https://prafrota-be-bff-tenant-api.grupopra.tech",
        "auth": "Bearer JWT",
        "response_format": "{ data: T[], totalCount: number, pageCount: number, currentPage: number }"
      },
      "viacep": {
        "proxy": "/api/ws/*",
        "purpose": "Address lookup by postal code"
      },
      "mercado_live": {
        "types": ["first_mile", "line_haul", "last_mile"],
        "pagination": "client-side",
        "data_file": "mercado-live-routes-data.json"
      }
    },

    "development_commands": {
      "serve_prafrota": "ng serve idt_app --configuration development",
      "serve_escala": "ng serve escala --configuration development", 
      "build_production": "ng build idt_app --configuration production",
      "test": "ng test",
      "lint": "ng lint"
    },

    "ai_response_guidelines": {
      "always_include": [
        "Functional and testable code",
        "Necessary imports",
        "Strong TypeScript typing", 
        "Portuguese comments",
        "Project patterns compliance"
      ],
      "never_include": [
        "Non-standalone components",
        "Services without Observable",
        "Template-driven forms",
        "Unnecessary imports",
        "Console.log in production code"
      ],
      "response_structure": {
        "solution": "Complete working code",
        "explanation": "Clear explanation in Portuguese",
        "usage": "How to implement/use the solution"
      }
    },

    "performance_considerations": {
      "table_performance": "Critical for large datasets",
      "lazy_loading": "Required for modules",
      "change_detection": "OnPush strategy when possible",
      "bundle_size": "Monitor and optimize"
    },

    "accessibility_requirements": {
      "standard": "WCAG 2.1 AA",
      "responsive": "Mobile-first design",
      "keyboard_navigation": "Full support required",
      "screen_readers": "ARIA labels and descriptions"
    },

    "current_priorities": {
      "domains": ["vehicles", "drivers", "routes", "finances"],
      "components": ["DataTable optimization", "TabSystem enhancement", "BaseDomain expansion"],
      "integrations": ["Mercado Live routes", "ViaCEP addresses", "PraFrota backend"]
    }
  },

  "context_validation": {
    "last_updated": "2024-12-13",
    "validation_rules": [
      "Check if similar component exists in shared/",
      "Verify BaseDomainComponent usage for ERP domains",
      "Ensure TypeScript strict mode compliance",
      "Validate Observable usage in services",
      "Confirm standalone component pattern"
    ]
  }
} 