# 02-ANALISIS - Sistema de Notificaciones Completo

## Analisis de Gaps

### 1. Base de Datos

| Tabla Requerida | Estado Previo | Accion |
|-----------------|---------------|--------|
| notifications | No existia | Crear en auth schema |
| user_push_tokens | No existia | Crear en auth schema |
| distribution_history | No existia | Crear en investment schema |
| distribution_runs | No existia | Crear en investment schema |

Nota: El plan original mencionaba `core` schema pero no existe, se uso `auth` schema.

### 2. Backend

| Componente | Estado Previo | Accion |
|------------|---------------|--------|
| notification.service.ts | Existia sin FCM real | Integrar Firebase |
| firebase.client.ts | No existia | Crear cliente FCM |
| Push token endpoints | No existian | Agregar POST/DELETE |
| Tests unitarios | No existian | Crear specs |

### 3. Frontend

| Componente | Estado Previo | Accion |
|------------|---------------|--------|
| notificationStore | No existia | Crear con Zustand |
| notification.service | No existia | Crear API client |
| NotificationBell | No existia | Crear componente |
| NotificationDropdown | No existia | Crear componente |
| NotificationItem | No existia | Crear componente |
| NotificationsPage | No existia | Crear pagina |
| MainLayout | Sin NotificationBell | Integrar |

## Dependencias

```
DDL -> Backend (queries usan tablas)
Backend notification.service -> firebase.client
Frontend store -> Backend API
Frontend components -> Store
```
