using System.Text.Json.Serialization;
using AIStudio.Chat;
using AIStudio.Settings.DataModel;
using AIStudio.Tools.RAG;
namespace AIStudio.Settings;
///
/// The common interface for all data sources.
///
[JsonPolymorphic(TypeDiscriminatorPropertyName = "$type_discriminator")]
[JsonDerivedType(typeof(DataSourceLocalDirectory), nameof(DataSourceType.LOCAL_DIRECTORY))]
[JsonDerivedType(typeof(DataSourceLocalFile), nameof(DataSourceType.LOCAL_FILE))]
[JsonDerivedType(typeof(DataSourceERI_V1), nameof(DataSourceType.ERI_V1))]
public interface IDataSource
{
///
/// The number of the data source.
///
public uint Num { get; init; }
///
/// The unique identifier of the data source.
///
public string Id { get; init; }
///
/// The name of the data source.
///
public string Name { get; init; }
///
/// Which type of data source is this?
///
public DataSourceType Type { get; init; }
///
/// Which data security policy is applied to this data source?
///
public DataSourceSecurity SecurityPolicy { get; init; }
///
/// Perform the data retrieval process.
///
/// The last prompt from the chat.
/// The chat thread.
/// The cancellation token.
/// The retrieved data context.
public Task> RetrieveDataAsync(IContent lastPrompt, ChatThread thread, CancellationToken token = default);
}