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

namespace Hc900Crawler.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();
}
