using ECPBLL.Collaboration.Interfaces; using ECPSL.Collaboration.Parameters; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace ECPSL.Collaboration.Endpoints.CollaborationSpaceIntegrations; /// The Team Space "Integrations" tab — connect state for the 3 known providers /// (Teams/SharePoint/Google Workspace). Mock only, per the ECP preview's explicit scope note — /// no real OAuth flow, just a persisted on/off flag per (space, provider). public class GetCollaborationSpaceIntegrations : BaseEndpoint> { private readonly ICollaborationSpaceIntegrationBLL _bll; public GetCollaborationSpaceIntegrations(ICollaborationSpaceIntegrationBLL bll) => _bll = bll; public override void Configure() { Get("/CollaborationSpaceIntegrations/GetCollaborationSpaceIntegrations"); AllowAnonymous(); } protected override string? GetCacheKey(GetCollaborationSpaceIntegrationsParameters req, LoginDTO login) => KeyGenerator.KeyGeneration( req.CollaborationSpaceId.ToString(), EntityConstant.OBJECTCOLLABORATIONSPACEINTEGRATIONS, CacheKeyLevel.CLIENT_LEVEL, login); protected override async Task> ExecuteAsync( GetCollaborationSpaceIntegrationsParameters req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.GetCollaborationSpaceIntegrationsAsync(req.CollaborationSpaceId, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.CLIENT_LEVEL, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.CLIENT_LEVEL, login, ex.Message, 500); } } }