namespace ERPCore.Repositories.Interfaces;

/// <summary>
/// Generic data-access base. Repositories own EF entities; business rules stay
/// in services (00-CORE §4). Concrete repositories extend this with query
/// methods specific to their aggregate.
/// </summary>
public interface IRepository<T> where T : class
{
    Task<T?> GetByIdAsync(object id, CancellationToken ct = default);
    Task<IReadOnlyList<T>> ListAsync(CancellationToken ct = default);

    /// <summary>Composable query root for service-defined filtering/paging.</summary>
    IQueryable<T> Query();

    Task AddAsync(T entity, CancellationToken ct = default);
    void Update(T entity);
    void Remove(T entity);
}
