using Microsoft.AspNetCore.Mvc;
using DorkNet.Server.Services;
namespace DorkNet.Server.Controllers.API.Announcements;
///
/// api.{rec.net,localhost}/api/announcement/v{1,2}/get — fetches the
/// current server announcement (shown on the watch's home tab). The
/// payload is sourced from so the
/// admin SPA's "edit announcement" form is the single place to
/// update what players see.
///
/// Wire shape per RecNet/AnnouncementDTO.cs — AnnouncementId,
/// AnnouncementType, LinkType, Platform are all required via
/// Util.GetKey (throws on miss); Title/Body/ImageName/LinkName/
/// LinkUri/CreatedAt are GetKeyOrDefault.
///
[ApiController]
public class AnnouncementsController(CommunityBoardService communityBoard) : ControllerBase
{
[HttpGet("api/announcement/v1/get")]
[HttpGet("api/announcement/v2/get")]
public async Task Current()
{
var board = await communityBoard.GetAsync();
var ann = board.CurrentAnnouncement;
if (ann is null) return Ok(Array.Empty