using DbFirst.Application.Repositories;
using MediatR;

namespace DbFirst.Application.Catalogs.Commands;

public class DeleteCatalogHandler : IRequestHandler<DeleteCatalogCommand, bool>
{
    private readonly ICatalogRepository _repository;

    public DeleteCatalogHandler(ICatalogRepository repository)
    {
        _repository = repository;
    }

    public async Task<bool> Handle(DeleteCatalogCommand request, CancellationToken cancellationToken)
    {
        return await _repository.DeleteAsync(request.Id, cancellationToken);
    }
}
