> ## Documentation Index
> Fetch the complete documentation index at: https://docs.criar.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Notifications Module

> SKOLE-NOTF — Notifications Module

# SKOLE-NOTF — Notifications Module

**Module ID:** `SKOLE-NOTF` | **Version:** 1.0 | **Status:** Active\
**Products:** Teacher App · Parent App (FCM token registered on auth)

***

## 1. Overview

| Field              | Value                                                                                                                                             |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Module Name**    | Push Notifications                                                                                                                                |
| **Module Code**    | NOTF                                                                                                                                              |
| **Business Value** | Real-time push alerts to parent and teacher devices for new diary entries, write-to updates, activity posts. Requires FCM tokens stored on login. |

***

## 2. Requirements

### Functional Requirements (FR)

*What the module must DO — actions, behaviors, and outcomes.*

* **SKOLE-NOTF-FR001:** The module shall allow teachers and staff to view a recent history of sent notification records.
* **SKOLE-NOTF-FR002:** The module shall automatically send push notifications when critical events occur: new diary entries, leave approvals, and write-to replies.
* **SKOLE-NOTF-FR003:** The module shall register and refresh FCM tokens for all users during the login process and upon device info updates.
* **SKOLE-NOTF-FR004:** The module shall allow users to mark notifications as read to track their interaction.

### Non-Functional Requirements (NFR)

*How well the module must do it — performance, security, and reliability.*

* **SKOLE-NOTF-NFR001:** The module shall perform low-latency delivery of push notifications to ensure timely communication.
* **SKOLE-NOTF-NFR002:** The module shall behave reliably by ensuring push tokens are unique per user+device combination to prevent duplicate or misdirected alerts.
* **SKOLE-NOTF-NFR003:** The module shall perform multi-tenant isolation of notification records by `skole_id`.

### Constraints

*Rules and boundaries — tech choices and platform restrictions.*

* **C001:** We must use Firebase Cloud Messaging (FCM) as our primary push notification provider to ensure cross-platform (iOS/Android) compatibility.
* **C002:** We cannot guarantee 100% delivery of notifications if the user's device is offline or has push notifications disabled at the OS level.

***

## 3. UI Requirements

### Teacher App

| ID                 | Screen              | Route            | Description                                              |
| ------------------ | ------------------- | ---------------- | -------------------------------------------------------- |
| `SKOLE-NOTF-UI001` | NotificationsScreen | `/notifications` | List of recent push notifications with read/unread state |

### Parent App

| ID                 | Screen              | Route            | Description                                                  |
| ------------------ | ------------------- | ---------------- | ------------------------------------------------------------ |
| `SKOLE-NOTF-UI002` | NotificationsScreen | `/notifications` | List of recent push alerts with deep-links to source modules |

**Components:**

| ID                 | Component           | Props                               |
| ------------------ | ------------------- | ----------------------------------- |
| `SKOLE-NOTF-UC001` | `NotificationItem`  | `notification`, `isRead`, `onPress` |
| `SKOLE-NOTF-UC002` | `NotificationBadge` | `count` — unread count on tab bar   |

***

## 4. API Endpoints

| ID                 | Method | Route                                   | Auth        | Description               |
| ------------------ | ------ | --------------------------------------- | ----------- | ------------------------- |
| `SKOLE-NOTF-EP001` | GET    | `/teachers-app/notifications`           | JWT (staff) | View notification history |
| `SKOLE-NOTF-EP002` | POST   | `/teachers-app/notifications/mark-read` | JWT (staff) | Mark notification as read |
