using System.Collections.Concurrent;
using ExperionCrawler.Core.Application.Feedforward;

namespace ExperionCrawler.Infrastructure.Control;

public sealed class FeedforwardAdvisoryStore : IFeedforwardAdvisoryStore
{
    private readonly ConcurrentDictionary<int, AdvisoryResult> _latest = new();
    public void Set(AdvisoryResult r) => _latest[r.ColumnId] = r;
    public AdvisoryResult? Get(int id) => _latest.TryGetValue(id, out var r) ? r : null;
    public IReadOnlyCollection<AdvisoryResult> GetAll() => _latest.Values.ToArray();
}
