using adas_core.Domain.Enums;
using adas_core.Domain.Models.MongoModels;
using MongoDB.Bson;
namespace adas_core.Application.Services.Interfaces;
public interface IHistoricalConfigChangesService
{
///
/// Asynchronously retrieves all historical configuration changes recorded in the system.
///
/// A task that represents the asynchronous operation. The task result contains a collection of all entries.
Task> GetAll();
///
/// Asynchronously retrieves a historical configuration change entry by its unique identifier.
/// Returns null when no matching historical configuration change is found for the specified id.
///
/// The unique identifier of the historical configuration change to retrieve.
/// A task that represents the asynchronous operation, containing the matching or null if not found.
Task Get(ObjectId id);
///
/// Asynchronously retrieves a collection of historical configuration changes filtered by the specified configuration type.
///
/// The configuration type used to filter the historical changes.
/// The maximum number of historical change records to return.
/// A task that represents the asynchronous operation, containing a collection of for the specified type.
Task> GetByType(DisplayConfigEnums.ConfigTypes type, int num);
///
/// Retrieves a collection of historical configuration changes associated with the specified user.
/// Results can be filtered by configuration type and limited in count; when the configuration type is not provided, all types are considered.
///
/// The identifier of the user whose historical configuration changes should be retrieved.
/// The optional configuration type used to filter the results; if null, changes for all configuration types are returned.
/// The maximum number of historical configuration change records to return.
/// A task that represents the asynchronous operation, containing the collection of historical configuration changes matching the specified criteria.
Task> GetByUser(string user, DisplayConfigEnums.ConfigTypes? configTypes,
int num);
///
/// Asynchronously retrieves the most recent historical configuration changes for the specified configuration type.
/// Returns null if no historical changes are found for the given type.
///
/// The configuration type used to look up the most recent historical changes.
/// A task that represents the asynchronous operation. The task result contains the last for the specified type, or null if no changes are available.
Task FindLastConfigChanges(DisplayConfigEnums.ConfigTypes configTypes);
///
/// Inserts a single historical configuration change record into the data store.
/// Returns the inserted record, or null if the insert could not be performed.
///
/// The historical configuration change entity to be inserted.
/// A task that represents the asynchronous operation, containing the inserted entity, or null if the insertion did not produce a result.
Task InsertOne(HistoricalConfigChanges historicalConfigChanges);
///
/// Updates an existing historical configuration change record with the provided data and returns the updated entity.
///
/// The historical configuration change entity containing the updated values to be persisted.
/// A task that resolves to the updated , or null if the record was not found.
Task UpdateHistoricalConfigChange(HistoricalConfigChanges historicalConfigChanges);
///
/// Deletes a historical configuration change identified by the specified identifier.
///
/// The identifier of the historical configuration change to delete.
Task DeleteHistoricalConfigChange(ObjectId id);
///
/// Logs a configuration change event, recording the user who made the change, the type of configuration affected, and the old and new configuration values.
///
/// The identifier of the user who made the configuration change.
/// The type of configuration that was changed.
/// The new configuration value after the change.
/// The previous configuration value before the change.
Task LogConfigChanged(string user, DisplayConfigEnums.ConfigTypes configType, string newConfig, string oldConfig);
}