using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using PolyTrader.Modules.ResolutionFarming.Models;

namespace PolyTrader.Modules.ResolutionFarming.Persistence
{
    public interface IRfSettingsRepository
    {
        List<RfSettings> GetAll();
        RfSettings? Get(int accountId);
        void Upsert(RfSettings settings);
    }

    public interface IRfCandidateRepository
    {
        void Insert(RfCandidate candidate);
        List<RfCandidate> GetRecent(int accountId, int limit);
    }

    public interface IRfPositionRepository
    {
        List<RfPosition> GetOpen(int accountId);
        List<RfPosition> GetAllOpen();
        RfPosition? Find(int accountId, string tokenId);
        void Upsert(RfPosition position);
        void Delete(int accountId, string tokenId);
        /// <summary>Anzahl heute (seit <paramref name="since"/>) neu eröffneter Positionen (Tages-Drossel).</summary>
        int CountOpenedSince(int accountId, DateTime since);
    }

    public interface IRfClosedTradeRepository
    {
        void Insert(RfClosedTrade trade);
        List<RfClosedTrade> Find(Expression<Func<RfClosedTrade, bool>> predicate);
        /// <summary>Summe des realisierten PnL seit <paramref name="since"/> (Kill-Switch).</summary>
        decimal RealizedPnlSince(int accountId, DateTime since);
    }
}
