# Certificates Workflow

## Practical flow

1. Open `/admin/certificates/templates`
Create at least one certificate template and set it to `active`.

2. Open `/admin/certificates/eligible`
This page shows enrollments that are ready for certificate issuance.

An enrollment is considered ready when:
- its status is `completed` or `confirmed`
- it has no issued certificate yet
- it is linked to a student account (`registration.user_id` exists)

3. Select the active template
Choose the certificate template from the selector at the top of the page.

4. Generate certificates
Use `إصدار الآن` for one row or `إصدار المحدد` for multiple rows.

5. Review issued certificates
Open `/admin/certificates/issued` to:
- download the PDF
- verify the public link
- revoke the certificate with a reason

## Template deletion rules

- Unused templates can be deleted.
- Templates already used by issued certificates cannot be deleted.
- This rule preserves auditability and keeps old certificates reproducible.

## Common blockers

- No active template: create or activate one first.
- Student account missing: certificate issuance is blocked until the registration is linked to a real student account.
- Enrollment not completed: the row will not appear in the eligible queue.
