using Domains;
namespace ApplicationLayer.GeneralNeededServices;
/// 
/// Generic repository pattern
/// 
/// Entity type
public interface IGenericRepository where T : class, IEntity
{
    /// Get all entities from data storage
    /// Cancellation token
    Task> GetAllAsync(CancellationToken cancellationToken);
    /// Get one entity with specific id
    /// Identifier of entity
    /// Cancellation token
    Task GetByIdAsync(Guid id, CancellationToken cancellationToken);
    /// Add entity to storage
    /// Entity to add
    /// Cancellation token
    Task AddAsync(T entity, CancellationToken cancellationToken);
    /// 
    /// Update entity in storage
    /// 
    /// Entity to update
    /// Cancellation token
    Task UpdateAsync(T entity, CancellationToken cancellationToken);
    /// 
    /// Remove entity from storage
    /// 
    /// Entity to remove
    void Remove(T entity);
    /// Save changes in storage
    Task SaveAsync(CancellationToken cancellationToken);
}