using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Responses;
using MongoDB.Bson;

namespace adas_core.Application.Repositories.Interfaces;

public interface IDisplayChartConfigRepository : IMongoRepository<ChartConfig>
{
    /// <summary>
    /// Asynchronously retrieves all chart configurations.
    /// </summary>
    /// <returns>A task that represents the asynchronous operation, containing a list of <see cref="ChartConfig"/> objects.</returns>
    Task<List<ChartConfig>> GetAll();
    /// <summary>
    /// Asynchronously retrieves a <see cref="ChartConfig"/> by its unique identifier, returning null if no matching configuration is found.
    /// </summary>
    /// <param name="configId">The identifier of the chart configuration to look up.</param>
    /// <returns>A task that yields the matching <see cref="ChartConfig"/>, or null when no configuration exists for the specified id.</returns>
    Task<ChartConfig?> GetById(ObjectId configId);
    /// <summary>
    /// Asynchronously inserts a new chart configuration into the data store and returns the persisted entity, which may be null if no record is produced.
    /// </summary>
    /// <param name="config">The chart configuration to insert.</param>
    /// <returns>A task that represents the asynchronous insert operation, containing the inserted <see cref="ChartConfig"/> or null when the operation yields no result.</returns>
    Task<ChartConfig?> InsertOneAsyncAndReturn(ChartConfig config);
    /// <summary>
    /// Updates a single chart configuration and returns the operation result wrapped in an update response.
    /// </summary>
    /// <param name="config">The chart configuration to update. May be null.</param>
    /// <returns>A task containing the update response with the updated chart configuration, which may be null.</returns>
    Task<UpdateResponse<ChartConfig?>> UpdateOne(ChartConfig? config);
    /// <summary>
    /// Deletes a single chart configuration identified by its unique identifier. Returns the deleted configuration, or <see langword="null"/> if no matching configuration was found.
    /// </summary>
    /// <param name="configId">The unique identifier of the chart configuration to delete.</param>
    /// <returns>A task that resolves to the deleted <see cref="ChartConfig"/>, or <see langword="null"/> if no configuration with the specified id exists.</returns>
    Task<ChartConfig?> DeleteOne(ObjectId configId);
}