using System;
using System.Collections.Generic;
using Net.Eagle0.Eagle.Api;

namespace eagle {
    using GameId = Int64;
    public interface IClientConnectionSubscriber {
        public GameId GameId { get; }
        public Int64? CurrentEagleToken { get; }
        public Int64? CurrentShardokToken(string shardokGameId);

        /// <summary>
        /// Callback to check if there's a pending command with the specified token.
        /// Set by PersistentClientConnection. Used to skip loading stale commands
        /// when a pending command is about to be posted.
        /// </summary>
        public Func<long, bool> HasPendingCommandWithToken { get; set; }

        public void ReceiveGameUpdate(GameUpdate update);

        /// <summary>
        /// Update the known result counts immediately when an update is received.
        /// Called from the gRPC thread BEFORE enqueueing to MainQueue, to ensure
        /// reconnects don't request stale data while MainQueue is blocked.
        /// </summary>
        public void UpdateResultCounts(GameUpdate update);

        // Used for registering for stream updates
        struct ShardokViewStatus {
            public string shardokGameId;
            public Int32 filteredResultCount;
            public bool requestFullResync;  // Request full state instead of delta
        }

        struct StreamingTextStatus {
            public string llmIdentifier;

            public Int32 knownByteCount;

            public Boolean knownComplete;

            public string streamAttemptId;
        }
        public int LastUnfilteredResultCount { get; }
        public List<ShardokViewStatus> ShardokViewStatuses { get; }
        public List<StreamingTextStatus> StreamingTextStatuses { get; }
    }
}
