using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using xAiModels.Interfaces.Enrichers; using xAiModels.Models.Dtos; using xCommons.Extensions; using xIdentityService.Interfaces; using xIdentityService.Extensions; using xModels.Dtos; using xAiModels.Interfaces; using xAiModels.Interfaces.Dtos; namespace xAiModels.Providers.Enrichers { public class XAiProjectEnricher : IXAiProjectEnricher { private readonly IXIdentityProvider identityProvider; private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider; private readonly IXAiConversationRepositoryService conversationRepositoryService; private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider; public XAiProjectEnricher( IXIdentityProvider identityProvider, IXAiProjectTitleResourceProvider projectTitleResourceProvider, IXAiConversationRepositoryService conversationRepositoryService, IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider ) { this.identityProvider = identityProvider; this.projectTitleResourceProvider = projectTitleResourceProvider; this.conversationRepositoryService = conversationRepositoryService; this.projectDescriptionResourceProvider = projectDescriptionResourceProvider; } public Task EnrichAsync( XAiProjectDto source, XAiProjectDto destination, CancellationToken cancellationToken = default ) { throw new NotImplementedException(); } public Task EnrichRangeAsync( IEnumerable sources, IEnumerable destinations, CancellationToken cancellationToken = default ) { throw new NotImplementedException(); } // #region Private ... /// /// Reading Owner User Info ... /// /// /// /// private async Task ResolveOwnerAsync( string ownerId, CancellationToken cancellationToken = default ) { // XPersonDto result = null; // // Validate ... if (ownerId.IsNullOrEmpty()) { return result; } // // Try to Retrieve User Info ... var device = identityProvider.GetDevice(); var userInfo = await identityProvider.GetUserInfo( device: device, userSelectByParam: ownerId ); result = userInfo.ToXPersonDto(); // return result; } /// /// Retrieve Title Resource ... /// /// /// /// private async Task ResolveTitleAsync( string identifier, CancellationToken cancellationToken = default ) { // XResourceDto result = null; // // Validate ... if (identifier.IsNullOrEmpty()) { return result; } // result = await projectTitleResourceProvider.GetResource( identifier: identifier, cancellationToken: cancellationToken ); // return result; } /// /// Retrieve Description Resource ... /// /// /// /// private async Task ResolveDescriptionAsync( string identifier, CancellationToken cancellationToken = default ) { // XResourceDto result = null; // // Validate ... if (identifier.IsNullOrEmpty()) { return result; } // result = await projectDescriptionResourceProvider.GetResource( identifier: identifier, cancellationToken: cancellationToken ); // return result; } /// /// Retrieve Project Conversations ... /// /// /// /// private async Task> ResolveConversationsAsync( Guid projectId, CancellationToken cancellationToken = default ) { // List result = []; // // Validate ... if (projectId.IsNull() || projectId.IsDefaultGuid() ) { return result; } // var items = await conversationRepositoryService.FindManyAsync( orderBuilder: null, includeBuilder: null, ignoreSoftDeleteds: true, predicate: x => x.Id == projectId, cancellationToken: cancellationToken ); result = [.. items]; // return result; } #endregion } }