using Microsoft.AspNetCore.Mvc; using Meezi.Infrastructure.Services.Platform; using Meezi.Core.Interfaces; using Meezi.Shared; namespace Meezi.API.Controllers; [Route("api/cafes/{cafeId}/platform")] public class CafePlatformController : CafeApiControllerBase { private readonly IPlatformCatalogService _catalog; public CafePlatformController(IPlatformCatalogService catalog) { _catalog = catalog; } [HttpGet("features")] public async Task GetFeatures(string cafeId, ITenantContext tenant, CancellationToken cancellationToken) { if (EnsureCafeAccess(cafeId, tenant) is { } denied) return denied; if (tenant.PlanTier is null) return Ok(new ApiResponse(true, new Dictionary())); var features = await _catalog.GetEffectiveFeaturesForCafeAsync( cafeId, tenant.PlanTier.Value, cancellationToken); return Ok(new ApiResponse(true, features)); } [HttpGet("plans")] public async Task GetPublicPlans(CancellationToken cancellationToken) { var plans = await _catalog.GetPlansAsync(cancellationToken); return Ok(new ApiResponse(true, plans)); } }