# Certificates, Level Classifications & Rankings Module

## Purpose
Provides achievement and recognition infrastructure: certificates for course/competition completion, level classifications for student grouping, ranking titles for leaderboard achievements, and ranking computation.

## Key Models

### Certificate (`app/Models/Certificate.php`)
- **Fields:** `program_id`, `user_id`, `scope` (enum: system/program/teacher), `bg_image`, `template_content` (json)
- **Feature:** Creation consumes `certificates_enabled` (program subscription — boolean feature toggle)
- Certificates support customizable background images and template content

### LevelClassification (`app/Models/LevelClassification.php`)
- **Fields:** `program_id`, `user_id`, `name` (json, translatable), `picture` (nullable), `description` (json), `purpose` (json), `scope` (enum: system/program/teacher)
- **Feature:** Creation consumes `no_of_level_classifications` (teacher subscription)
- Used by Assessments to classify difficulty/level

### RankingTitle (`app/Models/RankingTitle.php`)
- **Fields:** `program_id`, `user_id`, `name` (json, translatable), `picture` (nullable), `description` (json), `purpose` (json), `scope` (enum: system/program/teacher)
- **Feature:** Creation consumes `no_of_ranking_titles` (teacher subscription)
- Used for leaderboard ranking tiers

## RankingService (`app/Services/RankingService.php`)
Computes rankings for competitions and marathons:
- `CompetitionLeaderboardWidget` — Displays competition rankings
- `MarathonLeaderboardWidget` — Displays marathon rankings
- Rankings consider assessment attempt scores and timing

## Feature Entitlement

| Feature | Scope | Default Limit |
|---------|-------|---------------|
| `certificates_enabled` | Program | true (boolean) |
| `no_of_level_classifications` | Teacher | 3 |
| `no_of_ranking_titles` | Teacher | 3 |

## Filament Widgets
- `CompetitionLeaderboardWidget` — Real-time competition standings
- `MarathonLeaderboardWidget` — Marathon cumulative rankings

## Filament Pages
- `AssessmentRanking` — Ranking view for assessments
- `AssessmentClassification` — Classification management for assessments
- `AssessmentsClassification` — Bulk classification management

## Related Workflows
- **[Assessment Lifecycle Workflow](../WORKFLOWS.md#4-assessment-lifecycle-workflow)** — Certificates and rankings are computed at assessment completion
