using Books.Api.Domain.Products;
using EventFlow.Aggregates;
using EventFlow.ReadStores;

namespace Books.Api.EventFlow.ReadModels;

public class ProductReadModelLocator : IReadModelLocator
{
    public IEnumerable<string> GetReadModelIds(IDomainEvent domainEvent)
    {
        if (domainEvent is IDomainEvent<ProductAggregate, ProductId> typedEvent)
        {
            yield return typedEvent.AggregateIdentity.Value;
        }
    }
}
