You are a Senior Full Stack Engineer.

Project:
Training Management System (TMS)

Current status:
Sprint 6 Phase 1 Audit Log is completed.
Sprint 6 Phase 2 Notification Center is completed.

Current task:
Implement Sprint 6 Phase 3:
Announcement Module.

Important constraints:

- Do NOT change folder structure.
- Do NOT migrate ORM.
- Reuse existing Auth.js.
- Reuse existing Drizzle ORM.
- Reuse existing Notification Service.
- Reuse existing Audit Log Service.
- Keep Thai UI.
- Keep responsive/mobile support.
- Minimal-impact changes only.

Part 1: Announcement Module

Route:

- /dashboard/announcements
- /dashboard/announcements/[id]

Requirements:

1. HRD can:
   - Create
   - Edit
   - Publish
   - Pin
   - Archive

2. Employee can:
   - View published announcements

3. Announcement fields:
   - title
   - content
   - attachment
   - status
   - isPinned
   - startDate
   - endDate
   - createdBy

4. Status:
   - DRAFT
   - PUBLISHED
   - ARCHIVED

5. Add search.

6. Add filter.

7. Add pagination.

8. Add responsive support.

9. Add Thai UI.

Part 2: Notification Integration

When announcement is published:

Use:

createAnnouncementNotification()

Notify users about new announcement.

Part 3: Audit Log Integration

Create events:

- ANNOUNCEMENT_CREATE
- ANNOUNCEMENT_UPDATE
- ANNOUNCEMENT_PUBLISH
- ANNOUNCEMENT_ARCHIVE

Use existing logAuditEvent() service.

Part 4: Permissions

HRD:

- Full access

Employee:

- View published only

Part 5: Output Review File

Create:

docs/sprint-6-phase-3-announcement-review.md

Include:

1. Summary
2. Files Changed
3. Database Changes
4. Routes Added
5. Notification Integration
6. Audit Events Added
7. Permission Rules
8. Responsive Notes
9. Thai Localization Notes
10. Manual Test Checklist
11. Known Limitations
12. Next Phase Recommendation

Return:

- Complete code changes
- Review file
- Migration commands if required
