# FASE 5: ANALISIS DE DEPENDENCIAS COMPLETO

**Fecha:** 2026-01-10
**Objetivo:** Mapear todas las dependencias para la implementacion de APIs frontend
**Estado:** COMPLETADO
**Basado en:** FASE4-VALIDACION-PLAN-VS-REQUISITOS.md

---

## 1. RESUMEN DE ENDPOINTS DISPONIBLES

### 1.1 Estadisticas por Modulo

| Modulo | Endpoints | Lines Routes | Controllers | Services |
|--------|-----------|--------------|-------------|----------|
| Purchases | 23 | 91 | 1 | 2 |
| Projects | 24 | 76 | 1 | 3 |
| CRM | 32 | 145 | 1 | 4 |
| HR | 62 | 337 | 2 | 8 |
| **Total** | **141** | **649** | **5** | **17** |

---

## 2. DEPENDENCIAS PURCHASES API

### 2.1 Endpoints Disponibles

#### Purchase Orders:
```
GET    /api/purchases           → Lista ordenes de compra
GET    /api/purchases/:id       → Obtener orden por ID
POST   /api/purchases           → Crear orden
PUT    /api/purchases/:id       → Actualizar orden
POST   /api/purchases/:id/confirm → Confirmar orden
POST   /api/purchases/:id/cancel  → Cancelar orden
DELETE /api/purchases/:id       → Eliminar orden
```

#### RFQs (Request for Quotation):
```
GET    /api/purchases/rfqs           → Lista RFQs
GET    /api/purchases/rfqs/:id       → Obtener RFQ por ID
POST   /api/purchases/rfqs           → Crear RFQ
PUT    /api/purchases/rfqs/:id       → Actualizar RFQ
DELETE /api/purchases/rfqs/:id       → Eliminar RFQ
```

#### RFQ Lines:
```
POST   /api/purchases/rfqs/:id/lines          → Agregar linea
PUT    /api/purchases/rfqs/:id/lines/:lineId  → Actualizar linea
DELETE /api/purchases/rfqs/:id/lines/:lineId  → Eliminar linea
```

#### RFQ Workflow:
```
POST   /api/purchases/rfqs/:id/send      → Enviar RFQ
POST   /api/purchases/rfqs/:id/responded → Marcar como respondido
POST   /api/purchases/rfqs/:id/accept    → Aceptar RFQ
POST   /api/purchases/rfqs/:id/reject    → Rechazar RFQ
POST   /api/purchases/rfqs/:id/cancel    → Cancelar RFQ
```

### 2.2 Estructura Frontend Propuesta

```typescript
// frontend/src/features/purchases/api/purchases.api.ts

// Purchase Orders API
export const purchaseOrdersApi = {
  getAll: (params) => apiClient.get('/api/purchases', { params }),
  getById: (id) => apiClient.get(`/api/purchases/${id}`),
  create: (data) => apiClient.post('/api/purchases', data),
  update: (id, data) => apiClient.put(`/api/purchases/${id}`, data),
  delete: (id) => apiClient.delete(`/api/purchases/${id}`),
  confirm: (id) => apiClient.post(`/api/purchases/${id}/confirm`),
  cancel: (id) => apiClient.post(`/api/purchases/${id}/cancel`),
};

// RFQs API
export const rfqsApi = {
  getAll: (params) => apiClient.get('/api/purchases/rfqs', { params }),
  getById: (id) => apiClient.get(`/api/purchases/rfqs/${id}`),
  create: (data) => apiClient.post('/api/purchases/rfqs', data),
  update: (id, data) => apiClient.put(`/api/purchases/rfqs/${id}`, data),
  delete: (id) => apiClient.delete(`/api/purchases/rfqs/${id}`),
  // Lines
  addLine: (id, data) => apiClient.post(`/api/purchases/rfqs/${id}/lines`, data),
  updateLine: (id, lineId, data) => apiClient.put(`/api/purchases/rfqs/${id}/lines/${lineId}`, data),
  removeLine: (id, lineId) => apiClient.delete(`/api/purchases/rfqs/${id}/lines/${lineId}`),
  // Workflow
  send: (id) => apiClient.post(`/api/purchases/rfqs/${id}/send`),
  markResponded: (id) => apiClient.post(`/api/purchases/rfqs/${id}/responded`),
  accept: (id) => apiClient.post(`/api/purchases/rfqs/${id}/accept`),
  reject: (id) => apiClient.post(`/api/purchases/rfqs/${id}/reject`),
  cancel: (id) => apiClient.post(`/api/purchases/rfqs/${id}/cancel`),
};
```

---

## 3. DEPENDENCIAS PROJECTS API

### 3.1 Endpoints Disponibles

#### Projects:
```
GET    /api/projects              → Lista proyectos
GET    /api/projects/:id          → Obtener proyecto por ID
POST   /api/projects              → Crear proyecto
PUT    /api/projects/:id          → Actualizar proyecto
DELETE /api/projects/:id          → Eliminar proyecto
GET    /api/projects/:id/stats    → Estadisticas del proyecto
GET    /api/projects/:id/tasks    → Tareas del proyecto
GET    /api/projects/:id/timesheets → Hojas de tiempo del proyecto
```

#### Tasks:
```
GET    /api/projects/tasks/all    → Lista todas las tareas
GET    /api/projects/tasks/:id    → Obtener tarea por ID
POST   /api/projects/tasks        → Crear tarea
PUT    /api/projects/tasks/:id    → Actualizar tarea
DELETE /api/projects/tasks/:id    → Eliminar tarea
POST   /api/projects/tasks/:id/move   → Mover tarea
POST   /api/projects/tasks/:id/assign → Asignar tarea
```

#### Timesheets:
```
GET    /api/projects/timesheets/all     → Lista todas las hojas
GET    /api/projects/timesheets/me      → Mis hojas de tiempo
GET    /api/projects/timesheets/pending → Pendientes de aprobacion
GET    /api/projects/timesheets/:id     → Obtener hoja por ID
POST   /api/projects/timesheets         → Crear hoja
PUT    /api/projects/timesheets/:id     → Actualizar hoja
DELETE /api/projects/timesheets/:id     → Eliminar hoja
POST   /api/projects/timesheets/:id/submit  → Enviar para aprobacion
POST   /api/projects/timesheets/:id/approve → Aprobar hoja
POST   /api/projects/timesheets/:id/reject  → Rechazar hoja
```

### 3.2 Estructura Frontend Propuesta

```typescript
// frontend/src/features/projects/api/projects.api.ts

// Projects API
export const projectsApi = {
  getAll: (params) => apiClient.get('/api/projects', { params }),
  getById: (id) => apiClient.get(`/api/projects/${id}`),
  create: (data) => apiClient.post('/api/projects', data),
  update: (id, data) => apiClient.put(`/api/projects/${id}`, data),
  delete: (id) => apiClient.delete(`/api/projects/${id}`),
  getStats: (id) => apiClient.get(`/api/projects/${id}/stats`),
  getTasks: (id) => apiClient.get(`/api/projects/${id}/tasks`),
  getTimesheets: (id) => apiClient.get(`/api/projects/${id}/timesheets`),
};

// Tasks API
export const tasksApi = {
  getAll: (params) => apiClient.get('/api/projects/tasks/all', { params }),
  getById: (id) => apiClient.get(`/api/projects/tasks/${id}`),
  create: (data) => apiClient.post('/api/projects/tasks', data),
  update: (id, data) => apiClient.put(`/api/projects/tasks/${id}`, data),
  delete: (id) => apiClient.delete(`/api/projects/tasks/${id}`),
  move: (id, data) => apiClient.post(`/api/projects/tasks/${id}/move`, data),
  assign: (id, data) => apiClient.post(`/api/projects/tasks/${id}/assign`, data),
};

// Timesheets API
export const timesheetsApi = {
  getAll: (params) => apiClient.get('/api/projects/timesheets/all', { params }),
  getMine: (params) => apiClient.get('/api/projects/timesheets/me', { params }),
  getPending: (params) => apiClient.get('/api/projects/timesheets/pending', { params }),
  getById: (id) => apiClient.get(`/api/projects/timesheets/${id}`),
  create: (data) => apiClient.post('/api/projects/timesheets', data),
  update: (id, data) => apiClient.put(`/api/projects/timesheets/${id}`, data),
  delete: (id) => apiClient.delete(`/api/projects/timesheets/${id}`),
  submit: (id) => apiClient.post(`/api/projects/timesheets/${id}/submit`),
  approve: (id) => apiClient.post(`/api/projects/timesheets/${id}/approve`),
  reject: (id, data) => apiClient.post(`/api/projects/timesheets/${id}/reject`, data),
};
```

---

## 4. DEPENDENCIAS CRM API

### 4.1 Endpoints Disponibles

#### Leads:
```
GET    /api/crm/leads           → Lista leads
GET    /api/crm/leads/:id       → Obtener lead por ID
POST   /api/crm/leads           → Crear lead
PUT    /api/crm/leads/:id       → Actualizar lead
DELETE /api/crm/leads/:id       → Eliminar lead
POST   /api/crm/leads/:id/move    → Mover a otra etapa
POST   /api/crm/leads/:id/convert → Convertir a oportunidad
POST   /api/crm/leads/:id/lost    → Marcar como perdido
```

#### Opportunities:
```
GET    /api/crm/opportunities           → Lista oportunidades
GET    /api/crm/opportunities/:id       → Obtener oportunidad por ID
POST   /api/crm/opportunities           → Crear oportunidad
PUT    /api/crm/opportunities/:id       → Actualizar oportunidad
DELETE /api/crm/opportunities/:id       → Eliminar oportunidad
POST   /api/crm/opportunities/:id/move  → Mover a otra etapa
POST   /api/crm/opportunities/:id/won   → Marcar como ganada
POST   /api/crm/opportunities/:id/lost  → Marcar como perdida
POST   /api/crm/opportunities/:id/quote → Crear cotizacion
```

#### Pipeline:
```
GET    /api/crm/pipeline              → Vista pipeline
```

#### Lead Stages:
```
GET    /api/crm/lead-stages           → Lista etapas de leads
POST   /api/crm/lead-stages           → Crear etapa
PUT    /api/crm/lead-stages/:id       → Actualizar etapa
DELETE /api/crm/lead-stages/:id       → Eliminar etapa
```

#### Opportunity Stages:
```
GET    /api/crm/opportunity-stages       → Lista etapas de oportunidades
POST   /api/crm/opportunity-stages       → Crear etapa
PUT    /api/crm/opportunity-stages/:id   → Actualizar etapa
DELETE /api/crm/opportunity-stages/:id   → Eliminar etapa
```

#### Lost Reasons:
```
GET    /api/crm/lost-reasons           → Lista razones de perdida
POST   /api/crm/lost-reasons           → Crear razon
PUT    /api/crm/lost-reasons/:id       → Actualizar razon
DELETE /api/crm/lost-reasons/:id       → Eliminar razon
```

#### Tags:
```
GET    /api/crm/tags           → Lista tags
GET    /api/crm/tags/:id       → Obtener tag por ID
POST   /api/crm/tags           → Crear tag
PUT    /api/crm/tags/:id       → Actualizar tag
DELETE /api/crm/tags/:id       → Eliminar tag
```

### 4.2 Estructura Frontend Propuesta

```typescript
// frontend/src/features/crm/api/crm.api.ts

// Leads API
export const leadsApi = {
  getAll: (params) => apiClient.get('/api/crm/leads', { params }),
  getById: (id) => apiClient.get(`/api/crm/leads/${id}`),
  create: (data) => apiClient.post('/api/crm/leads', data),
  update: (id, data) => apiClient.put(`/api/crm/leads/${id}`, data),
  delete: (id) => apiClient.delete(`/api/crm/leads/${id}`),
  move: (id, data) => apiClient.post(`/api/crm/leads/${id}/move`, data),
  convert: (id) => apiClient.post(`/api/crm/leads/${id}/convert`),
  markLost: (id, data) => apiClient.post(`/api/crm/leads/${id}/lost`, data),
};

// Opportunities API
export const opportunitiesApi = {
  getAll: (params) => apiClient.get('/api/crm/opportunities', { params }),
  getById: (id) => apiClient.get(`/api/crm/opportunities/${id}`),
  create: (data) => apiClient.post('/api/crm/opportunities', data),
  update: (id, data) => apiClient.put(`/api/crm/opportunities/${id}`, data),
  delete: (id) => apiClient.delete(`/api/crm/opportunities/${id}`),
  move: (id, data) => apiClient.post(`/api/crm/opportunities/${id}/move`, data),
  markWon: (id) => apiClient.post(`/api/crm/opportunities/${id}/won`),
  markLost: (id, data) => apiClient.post(`/api/crm/opportunities/${id}/lost`, data),
  createQuote: (id) => apiClient.post(`/api/crm/opportunities/${id}/quote`),
};

// Pipeline API
export const pipelineApi = {
  get: (params) => apiClient.get('/api/crm/pipeline', { params }),
};

// Lead Stages API
export const leadStagesApi = {
  getAll: () => apiClient.get('/api/crm/lead-stages'),
  create: (data) => apiClient.post('/api/crm/lead-stages', data),
  update: (id, data) => apiClient.put(`/api/crm/lead-stages/${id}`, data),
  delete: (id) => apiClient.delete(`/api/crm/lead-stages/${id}`),
};

// Opportunity Stages API
export const opportunityStagesApi = {
  getAll: () => apiClient.get('/api/crm/opportunity-stages'),
  create: (data) => apiClient.post('/api/crm/opportunity-stages', data),
  update: (id, data) => apiClient.put(`/api/crm/opportunity-stages/${id}`, data),
  delete: (id) => apiClient.delete(`/api/crm/opportunity-stages/${id}`),
};

// Lost Reasons API
export const lostReasonsApi = {
  getAll: () => apiClient.get('/api/crm/lost-reasons'),
  create: (data) => apiClient.post('/api/crm/lost-reasons', data),
  update: (id, data) => apiClient.put(`/api/crm/lost-reasons/${id}`, data),
  delete: (id) => apiClient.delete(`/api/crm/lost-reasons/${id}`),
};

// Tags API
export const tagsApi = {
  getAll: () => apiClient.get('/api/crm/tags'),
  getById: (id) => apiClient.get(`/api/crm/tags/${id}`),
  create: (data) => apiClient.post('/api/crm/tags', data),
  update: (id, data) => apiClient.put(`/api/crm/tags/${id}`, data),
  delete: (id) => apiClient.delete(`/api/crm/tags/${id}`),
};
```

---

## 5. DEPENDENCIAS HR API

### 5.1 Endpoints Disponibles

#### Employees (8 endpoints):
```
GET    /api/hr/employees                → Lista empleados
GET    /api/hr/employees/:id            → Obtener empleado por ID
GET    /api/hr/employees/:id/subordinates → Subordinados
POST   /api/hr/employees                → Crear empleado
PUT    /api/hr/employees/:id            → Actualizar empleado
POST   /api/hr/employees/:id/terminate  → Terminar empleado
POST   /api/hr/employees/:id/reactivate → Reactivar empleado
DELETE /api/hr/employees/:id            → Eliminar empleado
```

#### Departments (5 endpoints):
```
GET    /api/hr/departments           → Lista departamentos
GET    /api/hr/departments/:id       → Obtener departamento
POST   /api/hr/departments           → Crear departamento
PUT    /api/hr/departments/:id       → Actualizar departamento
DELETE /api/hr/departments/:id       → Eliminar departamento
```

#### Job Positions (4 endpoints):
```
GET    /api/hr/positions           → Lista posiciones
POST   /api/hr/positions           → Crear posicion
PUT    /api/hr/positions/:id       → Actualizar posicion
DELETE /api/hr/positions/:id       → Eliminar posicion
```

#### Contracts (8 endpoints):
```
GET    /api/hr/contracts           → Lista contratos
GET    /api/hr/contracts/:id       → Obtener contrato
POST   /api/hr/contracts           → Crear contrato
PUT    /api/hr/contracts/:id       → Actualizar contrato
POST   /api/hr/contracts/:id/activate  → Activar contrato
POST   /api/hr/contracts/:id/terminate → Terminar contrato
POST   /api/hr/contracts/:id/cancel    → Cancelar contrato
DELETE /api/hr/contracts/:id       → Eliminar contrato
```

#### Leave Types (4 endpoints):
```
GET    /api/hr/leave-types           → Lista tipos de permiso
POST   /api/hr/leave-types           → Crear tipo
PUT    /api/hr/leave-types/:id       → Actualizar tipo
DELETE /api/hr/leave-types/:id       → Eliminar tipo
```

#### Leaves (10 endpoints):
```
GET    /api/hr/leaves           → Lista permisos
GET    /api/hr/leaves/:id       → Obtener permiso
POST   /api/hr/leaves           → Crear permiso
PUT    /api/hr/leaves/:id       → Actualizar permiso
POST   /api/hr/leaves/:id/submit   → Enviar para aprobacion
POST   /api/hr/leaves/:id/approve  → Aprobar permiso
POST   /api/hr/leaves/:id/reject   → Rechazar permiso
POST   /api/hr/leaves/:id/cancel   → Cancelar permiso
DELETE /api/hr/leaves/:id       → Eliminar permiso
```

#### Skills (Skill Types, Skills, Skill Levels, Employee Skills):
```
# Skill Types
GET    /api/hr/skill-types           → Lista tipos de habilidad
GET    /api/hr/skill-types/:id       → Obtener tipo
POST   /api/hr/skill-types           → Crear tipo
PUT    /api/hr/skill-types/:id       → Actualizar tipo
DELETE /api/hr/skill-types/:id       → Eliminar tipo

# Skills
GET    /api/hr/skills           → Lista habilidades
GET    /api/hr/skills/:id       → Obtener habilidad
POST   /api/hr/skills           → Crear habilidad
PUT    /api/hr/skills/:id       → Actualizar habilidad
DELETE /api/hr/skills/:id       → Eliminar habilidad

# Skill Levels
GET    /api/hr/skill-levels           → Lista niveles
POST   /api/hr/skill-levels           → Crear nivel
PUT    /api/hr/skill-levels/:id       → Actualizar nivel
DELETE /api/hr/skill-levels/:id       → Eliminar nivel

# Employee Skills
GET    /api/hr/employee-skills               → Lista habilidades de empleados
GET    /api/hr/employees/:employeeId/skills  → Habilidades de un empleado
POST   /api/hr/employee-skills               → Asignar habilidad
PUT    /api/hr/employee-skills/:id           → Actualizar habilidad
DELETE /api/hr/employee-skills/:id           → Eliminar habilidad
```

#### Expenses (Expense Sheets, Expenses):
```
# Expense Sheets
GET    /api/hr/expense-sheets           → Lista hojas de gastos
GET    /api/hr/expense-sheets/:id       → Obtener hoja
POST   /api/hr/expense-sheets           → Crear hoja
PUT    /api/hr/expense-sheets/:id       → Actualizar hoja
POST   /api/hr/expense-sheets/:id/submit  → Enviar para aprobacion
POST   /api/hr/expense-sheets/:id/approve → Aprobar hoja
POST   /api/hr/expense-sheets/:id/reject  → Rechazar hoja
DELETE /api/hr/expense-sheets/:id       → Eliminar hoja

# Expenses
GET    /api/hr/expenses           → Lista gastos
GET    /api/hr/expenses/:id       → Obtener gasto
POST   /api/hr/expenses           → Crear gasto
PUT    /api/hr/expenses/:id       → Actualizar gasto
DELETE /api/hr/expenses/:id       → Eliminar gasto
```

#### Payslips (Structures, Payslips, Lines):
```
# Payslip Structures
GET    /api/hr/payslip-structures           → Lista estructuras
GET    /api/hr/payslip-structures/:id       → Obtener estructura
POST   /api/hr/payslip-structures           → Crear estructura
PUT    /api/hr/payslip-structures/:id       → Actualizar estructura
DELETE /api/hr/payslip-structures/:id       → Eliminar estructura

# Payslips
GET    /api/hr/payslips           → Lista nominas
GET    /api/hr/payslips/:id       → Obtener nomina
GET    /api/hr/payslips/:id/lines → Lineas de nomina
POST   /api/hr/payslips           → Crear nomina
PUT    /api/hr/payslips/:id       → Actualizar nomina
POST   /api/hr/payslips/:id/verify  → Verificar nomina
POST   /api/hr/payslips/:id/confirm → Confirmar nomina
POST   /api/hr/payslips/:id/cancel  → Cancelar nomina
DELETE /api/hr/payslips/:id       → Eliminar nomina

# Payslip Lines
POST   /api/hr/payslips/:id/lines          → Agregar linea
PUT    /api/hr/payslips/:id/lines/:lineId  → Actualizar linea
DELETE /api/hr/payslips/:id/lines/:lineId  → Eliminar linea
```

### 5.2 Estructura Frontend Propuesta

```typescript
// frontend/src/features/hr/api/hr.api.ts

// Employees API
export const employeesApi = {
  getAll: (params) => apiClient.get('/api/hr/employees', { params }),
  getById: (id) => apiClient.get(`/api/hr/employees/${id}`),
  getSubordinates: (id) => apiClient.get(`/api/hr/employees/${id}/subordinates`),
  create: (data) => apiClient.post('/api/hr/employees', data),
  update: (id, data) => apiClient.put(`/api/hr/employees/${id}`, data),
  terminate: (id, data) => apiClient.post(`/api/hr/employees/${id}/terminate`, data),
  reactivate: (id) => apiClient.post(`/api/hr/employees/${id}/reactivate`),
  delete: (id) => apiClient.delete(`/api/hr/employees/${id}`),
  getSkills: (id) => apiClient.get(`/api/hr/employees/${id}/skills`),
};

// Departments API
export const departmentsApi = {
  getAll: (params) => apiClient.get('/api/hr/departments', { params }),
  getById: (id) => apiClient.get(`/api/hr/departments/${id}`),
  create: (data) => apiClient.post('/api/hr/departments', data),
  update: (id, data) => apiClient.put(`/api/hr/departments/${id}`, data),
  delete: (id) => apiClient.delete(`/api/hr/departments/${id}`),
};

// Job Positions API
export const positionsApi = {
  getAll: (params) => apiClient.get('/api/hr/positions', { params }),
  create: (data) => apiClient.post('/api/hr/positions', data),
  update: (id, data) => apiClient.put(`/api/hr/positions/${id}`, data),
  delete: (id) => apiClient.delete(`/api/hr/positions/${id}`),
};

// Contracts API
export const contractsApi = {
  getAll: (params) => apiClient.get('/api/hr/contracts', { params }),
  getById: (id) => apiClient.get(`/api/hr/contracts/${id}`),
  create: (data) => apiClient.post('/api/hr/contracts', data),
  update: (id, data) => apiClient.put(`/api/hr/contracts/${id}`, data),
  activate: (id) => apiClient.post(`/api/hr/contracts/${id}/activate`),
  terminate: (id, data) => apiClient.post(`/api/hr/contracts/${id}/terminate`, data),
  cancel: (id) => apiClient.post(`/api/hr/contracts/${id}/cancel`),
  delete: (id) => apiClient.delete(`/api/hr/contracts/${id}`),
};

// Leave Types API
export const leaveTypesApi = {
  getAll: () => apiClient.get('/api/hr/leave-types'),
  create: (data) => apiClient.post('/api/hr/leave-types', data),
  update: (id, data) => apiClient.put(`/api/hr/leave-types/${id}`, data),
  delete: (id) => apiClient.delete(`/api/hr/leave-types/${id}`),
};

// Leaves API
export const leavesApi = {
  getAll: (params) => apiClient.get('/api/hr/leaves', { params }),
  getById: (id) => apiClient.get(`/api/hr/leaves/${id}`),
  create: (data) => apiClient.post('/api/hr/leaves', data),
  update: (id, data) => apiClient.put(`/api/hr/leaves/${id}`, data),
  submit: (id) => apiClient.post(`/api/hr/leaves/${id}/submit`),
  approve: (id) => apiClient.post(`/api/hr/leaves/${id}/approve`),
  reject: (id, data) => apiClient.post(`/api/hr/leaves/${id}/reject`, data),
  cancel: (id) => apiClient.post(`/api/hr/leaves/${id}/cancel`),
  delete: (id) => apiClient.delete(`/api/hr/leaves/${id}`),
};

// Skills APIs
export const skillTypesApi = {
  getAll: () => apiClient.get('/api/hr/skill-types'),
  getById: (id) => apiClient.get(`/api/hr/skill-types/${id}`),
  create: (data) => apiClient.post('/api/hr/skill-types', data),
  update: (id, data) => apiClient.put(`/api/hr/skill-types/${id}`, data),
  delete: (id) => apiClient.delete(`/api/hr/skill-types/${id}`),
};

export const skillsApi = {
  getAll: () => apiClient.get('/api/hr/skills'),
  getById: (id) => apiClient.get(`/api/hr/skills/${id}`),
  create: (data) => apiClient.post('/api/hr/skills', data),
  update: (id, data) => apiClient.put(`/api/hr/skills/${id}`, data),
  delete: (id) => apiClient.delete(`/api/hr/skills/${id}`),
};

export const skillLevelsApi = {
  getAll: () => apiClient.get('/api/hr/skill-levels'),
  create: (data) => apiClient.post('/api/hr/skill-levels', data),
  update: (id, data) => apiClient.put(`/api/hr/skill-levels/${id}`, data),
  delete: (id) => apiClient.delete(`/api/hr/skill-levels/${id}`),
};

export const employeeSkillsApi = {
  getAll: (params) => apiClient.get('/api/hr/employee-skills', { params }),
  create: (data) => apiClient.post('/api/hr/employee-skills', data),
  update: (id, data) => apiClient.put(`/api/hr/employee-skills/${id}`, data),
  delete: (id) => apiClient.delete(`/api/hr/employee-skills/${id}`),
};

// Expenses APIs
export const expenseSheetsApi = {
  getAll: (params) => apiClient.get('/api/hr/expense-sheets', { params }),
  getById: (id) => apiClient.get(`/api/hr/expense-sheets/${id}`),
  create: (data) => apiClient.post('/api/hr/expense-sheets', data),
  update: (id, data) => apiClient.put(`/api/hr/expense-sheets/${id}`, data),
  submit: (id) => apiClient.post(`/api/hr/expense-sheets/${id}/submit`),
  approve: (id) => apiClient.post(`/api/hr/expense-sheets/${id}/approve`),
  reject: (id, data) => apiClient.post(`/api/hr/expense-sheets/${id}/reject`, data),
  delete: (id) => apiClient.delete(`/api/hr/expense-sheets/${id}`),
};

export const expensesApi = {
  getAll: (params) => apiClient.get('/api/hr/expenses', { params }),
  getById: (id) => apiClient.get(`/api/hr/expenses/${id}`),
  create: (data) => apiClient.post('/api/hr/expenses', data),
  update: (id, data) => apiClient.put(`/api/hr/expenses/${id}`, data),
  delete: (id) => apiClient.delete(`/api/hr/expenses/${id}`),
};

// Payslips APIs
export const payslipStructuresApi = {
  getAll: (params) => apiClient.get('/api/hr/payslip-structures', { params }),
  getById: (id) => apiClient.get(`/api/hr/payslip-structures/${id}`),
  create: (data) => apiClient.post('/api/hr/payslip-structures', data),
  update: (id, data) => apiClient.put(`/api/hr/payslip-structures/${id}`, data),
  delete: (id) => apiClient.delete(`/api/hr/payslip-structures/${id}`),
};

export const payslipsApi = {
  getAll: (params) => apiClient.get('/api/hr/payslips', { params }),
  getById: (id) => apiClient.get(`/api/hr/payslips/${id}`),
  getLines: (id) => apiClient.get(`/api/hr/payslips/${id}/lines`),
  create: (data) => apiClient.post('/api/hr/payslips', data),
  update: (id, data) => apiClient.put(`/api/hr/payslips/${id}`, data),
  verify: (id) => apiClient.post(`/api/hr/payslips/${id}/verify`),
  confirm: (id) => apiClient.post(`/api/hr/payslips/${id}/confirm`),
  cancel: (id) => apiClient.post(`/api/hr/payslips/${id}/cancel`),
  delete: (id) => apiClient.delete(`/api/hr/payslips/${id}`),
  // Lines
  addLine: (id, data) => apiClient.post(`/api/hr/payslips/${id}/lines`, data),
  updateLine: (id, lineId, data) => apiClient.put(`/api/hr/payslips/${id}/lines/${lineId}`, data),
  removeLine: (id, lineId) => apiClient.delete(`/api/hr/payslips/${id}/lines/${lineId}`),
};
```

---

## 6. RESUMEN DE DEPENDENCIAS

### 6.1 Matriz de Dependencias

| API Frontend | Backend Module | Services | Endpoints | Lineas Est. |
|--------------|----------------|----------|-----------|-------------|
| purchases.api.ts | purchases | 2 | 23 | ~200 |
| projects.api.ts | projects | 3 | 24 | ~180 |
| crm.api.ts | crm | 4 | 32 | ~250 |
| hr.api.ts | hr | 8 | 62 | ~400 |
| **Total** | **4 modulos** | **17 services** | **141 endpoints** | **~1,030** |

### 6.2 Dependencias Externas

Todas las APIs dependen de:
- `@/lib/api-client` - Cliente HTTP base
- Tipos TypeScript (opcionales pero recomendados)

### 6.3 Orden de Implementacion Sugerido

1. **purchases.api.ts** - Menor complejidad, patron claro
2. **projects.api.ts** - Complejidad media, estructura similar
3. **crm.api.ts** - Complejidad media, multiples sub-APIs
4. **hr.api.ts** - Mayor complejidad, mas sub-APIs

---

**Generado por:** Claude Code - Opus 4.5
**Fase CAPVED:** Analisis de Dependencias
**Documento:** FASE5-ANALISIS-DEPENDENCIAS-COMPLETO.md
