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

namespace Books.Api.EventFlow.ReadModels;

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