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

namespace adas_core.Application.Repositories.Interfaces;

public interface IDisplayCardConfigRepository : IMongoRepository<CardConfig>
{
    /// <summary>
    /// Asynchronously retrieves all available card configurations.
    /// </summary>
    /// <returns>A task that represents the asynchronous operation. The task result contains a list of all <see cref="CardConfig"/> items.</returns>
    Task<List<CardConfig>> GetAll();
    /// <summary>
    /// Retrieves a card configuration by its unique identifier, returning <c>null</c> when no matching configuration is found.
    /// </summary>
    /// <param name="configId">The unique identifier of the card configuration to look up.</param>
    /// <returns>A <see cref="Task{TResult}"/> that yields the matching <see cref="CardConfig"/> if found; otherwise, <c>null</c>.</returns>
    Task<CardConfig?> GetById(ObjectId configId);
    /// <summary>
    /// Asynchronously inserts a new <see cref="CardConfig"/> into the data store and returns the persisted record, which may include database-generated values.
    /// </summary>
    /// <param name="config">The <see cref="CardConfig"/> instance to insert.</param>
    /// <returns>A <see cref="Task{TResult}"/> that yields the inserted <see cref="CardConfig"/>, or <c>null</c> if the record could not be persisted.</returns>
    Task<CardConfig?> InsertOneAsyncAndReturn(CardConfig config);
    /// <summary>
    /// Updates a single <see cref="CardConfig"/> record based on the provided configuration.
    /// </summary>
    /// <param name="config">The <see cref="CardConfig"/> to update. May be <c>null</c> to indicate no update payload was provided.</param>
    /// <returns>A task that resolves to an <see cref="UpdateResponse{T}"/> containing the updated <see cref="CardConfig"/>, or <c>null</c> if no matching record was found.</returns>
    Task<UpdateResponse<CardConfig?>> UpdateOne(CardConfig? config);
    /// <summary>
    /// Deletes a single card configuration identified by the specified identifier, returning the removed configuration when found.
    /// </summary>
    /// <param name="configId">The unique identifier of the card configuration to delete.</param>
    /// <returns>A task that represents the asynchronous delete operation. The task result contains the deleted <see cref="CardConfig"/>, or <c>null</c> if no configuration with the specified identifier exists.</returns>
    Task<CardConfig?> DeleteOne(ObjectId configId);
}