using SIGCM2.Application.Common;
using SIGCM2.Domain.Entities;
namespace SIGCM2.Application.Abstractions.Persistence;
///
/// Write-side repository for Product.
/// All reads needed by write handlers are included here.
///
public interface IProductRepository
{
/// Inserts a new Product and returns the DB-assigned Id.
Task AddAsync(Product product, CancellationToken ct = default);
/// Returns the Product with the given Id, or null if not found.
Task GetByIdAsync(int id, CancellationToken ct = default);
/// Returns a paged result of Products matching the query.
Task> GetPagedAsync(ProductsQuery query, CancellationToken ct = default);
/// Persists all changes to an existing Product row.
Task UpdateAsync(Product product, CancellationToken ct = default);
///
/// Returns true if an active Product with the same Nombre exists for the given MedioId+ProductTypeId combination.
/// Pass excludeId to skip the self-comparison during rename (update scenario).
///
Task ExistsByNombreAsync(string nombre, int medioId, int productTypeId, int? excludeId = null, CancellationToken ct = default);
}