using System.Linq;
using System.Threading;
using xCommons.Extensions;
using xAiModels.Models.Dtos;
using System.Threading.Tasks;
using xAiModels.Models.Entities;
using System.Collections.Generic;
using xAiModels.Interfaces.Enrichers;
namespace xAiModels.Providers.Enrichers
{
public class XAiVectorEnricher : IXAiVectorEnricher
{
public XAiVectorEnricher()
{ }
//
#region Enrichers ...
///
/// Enrich Specified Item ...
///
///
///
///
public virtual async Task Enrich(
XAiVector source,
CancellationToken cancellationToken = default
)
{
//
// Mapping Default ...
var result = source.MapConvert();
result = await Enrich(
source: result,
cancellationToken: cancellationToken
);
//
return result;
}
///
/// Enrich Specified Item ...
///
///
///
///
public virtual async Task Enrich(
XAiVectorDto source,
CancellationToken cancellationToken = default
)
{
//
// Currently no additional enrichment needed for XAiVector
// This can be extended in the future if needed
return await Task.FromResult(source);
}
///
/// Enrich Specified Items ...
///
///
///
///
public virtual async Task> EnrichRange(
IEnumerable sources,
CancellationToken cancellationToken = default
)
{
//
var tasks = sources
.Select(x => Enrich(
source: x,
cancellationToken: cancellationToken
));
//
var result = await Task.WhenAll(tasks);
return result;
}
///
/// Enrich Specified Items ...
///
///
///
///
public virtual async Task> EnrichRange(
IEnumerable sources,
CancellationToken cancellationToken = default
)
{
//
var tasks = sources
.Select(x => Enrich(
source: x,
cancellationToken: cancellationToken
));
//
var result = await Task.WhenAll(tasks);
return result;
}
#endregion
}
}