using Microsoft.AspNetCore.Mvc;
using SVSim.EmulatedEntrypoint.Models.Dtos.Common;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;

namespace SVSim.EmulatedEntrypoint.Controllers;

/// <summary>
/// /config/* — viewer-scoped preference toggles. Fired by the client as fire-and-forget
/// after the deck-builder save flow (and from settings screens). Currently acknowledge-only:
/// UserConfig is stubbed in load/index + mypage/index until a viewer-config persistence
/// layer lands. Mirrors the set_deck_redis precedent (no-op accept).
/// </summary>
public class ConfigController : SVSimController
{
    [HttpPost("update_foil_preferred")]
    public ActionResult<EmptyResponse> UpdateFoilPreferred(ConfigUpdateFoilPreferredRequest request)
    {
        if (!TryGetViewerId(out long _)) return Unauthorized();
        // TODO(viewer-config-persist): write request.IsFoilPreferred onto the viewer's config row
        // and read it back in load/index + mypage/index instead of `new UserConfig()`.
        return new EmptyResponse();
    }

    [HttpPost("update_prize_preferred")]
    public ActionResult<EmptyResponse> UpdatePrizePreferred(ConfigUpdatePrizePreferredRequest request)
    {
        if (!TryGetViewerId(out long _)) return Unauthorized();
        // TODO(viewer-config-persist): see UpdateFoilPreferred.
        return new EmptyResponse();
    }
}
