# Announcements Module

## Purpose
Provides a notification bar system for displaying time-bound messages to users within the program panel. Announcements can be scoped at system, program, or teacher level.

## Key Model — Announcement (`app/Models/Announcement.php`)

### Fields
- `program_id`, `teacher_id` — Ownership
- `scope` (enum: `system`, `program`, `teacher`) — Who sees the announcement
- `title` (json, translatable)
- `starts_at`, `ends_at` (datetime, nullable) — Scheduling
- `duration_seconds` (integer) — Display duration
- `is_active` (boolean)

### Relationships
- `program()` → BelongsTo Program
- `teacher()` → BelongsTo User

### Scopes
- `scopeActive()` — Currently active based on dates
- `scopeSystem()`, `scopeProgram()`, `scopeTeacher()` — Filter by scope

### isActive() Method
Returns true only if: `is_active=true`, current time is between `starts_at` and `ends_at` (if set)

### Lifecycle Events
- `announcement.created`, `announcement.updated`, `announcement.deleted`

## Feature Entitlement

| Feature | Scope | Default Limit |
|---------|-------|---------------|
| `no_of_announcements` | Program | 5 |
| `no_of_announcements_per_teacher` | Teacher | 5 |

## UI Integration
- Announcements render via a Blade component in the Program panel header:
  `PanelsRenderHook::BODY_START` → `filament.components.announcement-bars`
- Shows active announcements relevant to the current user's scope

## Filament Resources
- `AnnouncementResource` — CRUD for announcements in Program panel
