<!-- generated-by: gsd-doc-writer -->
# Features & User Guide

## Feature Overview

SIDES provides a web-based dashboard for monitoring rainfall, water levels, and siren activations at telemetry stations in the Sungai Kupang catchment. Features are grouped by access level: public pages (no login), authenticated user pages, admin-only management, and a REST API.

---

## Public Pages

These pages are accessible without authentication.

### Dashboard (Map View)

| Route | Description |
|---|---|
| `GET /` or `GET /dashboard` | Interactive map powered by Leaflet.js. Displays all telemetry stations with their latest sensor readings. Served by `MapController`. |
| `GET /stations` | Returns a JSON list of stations and current readings. Used by the map to populate markers. |
| `GET /locale/{locale}` | Switches the application language. Supports `en` (English) and `bm` (Bahasa Malaysia). |

---

## Authenticated User Pages

All routes below require a logged-in session (Laravel `auth` middleware).

### General

| Route | Description |
|---|---|
| `GET /home` | Home page shown after login. |

### Rainfall Monitoring

| Route | Description |
|---|---|
| `GET /rainfall` | Tabular view of rainfall data with filters for station and date range. |
| `GET /rainfall/graph/{stationid}` | Hourly rainfall chart for a specific station. |
| `GET /rainfall/historical` | Historical hourly rainfall data (24 readings per day) with export option. |
| `GET /rainfall/historical/export` | Exports historical rainfall data to an Excel file. |

### Water Level Monitoring

| Route | Description |
|---|---|
| `GET /waterlevel` | Current water level readings in a filterable table. |
| `GET /waterlevel/graph/{stationid}` | Water level chart for a specific station. |
| `GET /waterlevel/historical` | Historical water level data with threshold lines and export option. |
| `GET /waterlevel/historical/export` | Exports historical water level data to an Excel file. |

### Threshold & Early Warning

| Route | Description |
|---|---|
| `GET /threshold` | 6-hour cumulative rainfall summary used for early warning (IDF-based). |
| `GET /threshold/graphData/{stationid}/{dates}` | Returns threshold graph data for a station and date range. |

### Siren Status

| Route | Description |
|---|---|
| `GET /siren` | Current siren status across all stations (last 3 days). |
| `GET /sirenhistory` | Paginated siren history, excluding "Normal" status, with PDF export option. |
| `GET /export/siren-history/pdf` | Exports siren history to a PDF file. |

### Notifications

| Route | Description |
|---|---|
| `GET /notificationrf` | Today's rainfall notifications. |
| `GET /notificationwl` | Today's water level notifications. |
| `GET /notificationsiren` | Today's siren notifications. |
| `GET /historyrf` | Historical rainfall notifications with PDF export. |
| `GET /historywl` | Historical water level notifications with PDF export. |

### CCTV & Profile

| Route | Description |
|---|---|
| `GET /cctv` | CCTV camera links for water level stations. |
| `GET /profile` | User profile management (Laravel Breeze). |

---

## Admin Pages

These routes require both authentication and admin privileges (`admin` middleware).

### Station Management

| Route | Description |
|---|---|
| `GET /stationmanagement` | List all stations (paginated, 5 per page). |
| `POST /stationmanagement/store` | Add a new station. |
| `POST /stationmanagement/{stationid}/update` | Edit an existing station. |
| `DELETE /stationmanagement/{stationid}/delete` | Delete a station. |

### User Management

| Route | Description |
|---|---|
| `GET /usermgmt` | List all users (paginated, 5 per page). |
| `POST /usermgmt/store` | Create a new user. |
| `POST /usermgmt/{userid}/update` | Edit user details. |
| `POST /usermgmt/{userid}/updatePassword` | Reset a user's password. |
| `DELETE /usermgmt/{userid}/delete` | Delete a user. |

---

## Authentication

Provided by Laravel Breeze with Blade views.

| Route | Description |
|---|---|
| `GET /login` | Login form. |
| `POST /login` | Authenticate credentials. |
| `GET /register` | Registration form. |
| `POST /register` | Create a new account. |
| `GET /forgot-password` | Request a password reset link. |
| `POST /forgot-password` | Send the reset link email. |
| `GET /reset-password` | Password reset form. |
| `POST /reset-password` | Submit new password. |
| `POST /logout` | End the session. |

---

## API Endpoints

All API endpoints are unauthenticated except `/api/login` which validates credentials.

### Data Retrieval

| Method | Endpoint | Description |
|---|---|---|
| GET | `/api/station/current` | Current station readings. |
| GET | `/api/station/rainfall` | Rainfall data. |
| GET | `/api/station/waterlevel` | Water level data. |
| GET | `/api/station/notification` | Latest notifications. |
| GET | `/api/station/history` | Historical data. |
| GET | `/api/station/siren` | Current siren status. |
| GET | `/api/station/siren/history` | Siren history. |

### Actions

| Method | Endpoint | Description |
|---|---|---|
| POST | `/api/login` | Validates user credentials. |
| POST | `/api/alert` | Submits an alert. |
