# @v2/message-of-the-day-service

V2 live-ops message-of-the-day service to push announcements to the shipped game
client without a client patch. The package validates authored messages, filters
active windows, applies client targeting, preserves per-account dismissal, and
emits compact client payloads for events, downtime, and patch notes.

Announcement types:

- `event`
- `downtime`
- `patch-notes`

Primary API:

- `buildV2MessageOfTheDayServiceSurface`
- `resolveV2MessageOfTheDayForClient`

The service exposes these live-ops endpoints as contract metadata:

- `GET /v2/live-ops/motd/{environment}`
- `POST /v2/live-ops/motd/{environment}/messages`
- `POST /v2/live-ops/motd/{environment}/messages/{messageId}/publish`

## Client Payload

`buildV2MessageOfTheDayServiceSurface` creates a versioned MOTD surface with
active announcements ordered by priority and start time. The payload sets
`pushAnnouncements: true`, includes an ETag, carries `announcementCount`, and
keeps `requiresClientPatch: false`.

`resolveV2MessageOfTheDayForClient` applies region, platform, build-version, and
account-level targeting before returning the client payload. Per-account
dismissal is preserved: dismissible messages are omitted when their `messageId`
is present in the account dismissal set, while non-dismissible downtime notices
remain visible and can require acknowledgement.

## Validation

The service rejects duplicate message IDs, invalid active windows, unsupported
platforms, invalid build ranges, and missing category metadata. Event messages
require `eventId`, downtime messages require `downtimeWindowId` and
`statusPageUrl`, and patch-note messages require `patchNotesUrl` for patch
notes.

The focused validation gate is `check-v2-message-of-the-day.py`.

## Verification

```bash
pnpm --filter @v2/message-of-the-day-service test
pnpm --filter @v2/message-of-the-day-service typecheck
pnpm --filter @v2/message-of-the-day-service lint
pnpm --filter @v2/message-of-the-day-service build
python3 V2/ue/Tools/check-v2-message-of-the-day.py
```
