using System;
using NT8.Core.Common.Interfaces;
using NT8.Core.Common.Models;
using NT8.Core.Risk;
using NT8.Core.Sizing;

namespace NT8.Adapters.NinjaTrader
{
    /// <summary>
    /// Interface for NinjaTrader 8 integration adapter
    /// </summary>
    public interface INT8Adapter
    {
        /// <summary>
        /// Initialize the adapter with required components
        /// </summary>
        void Initialize(IRiskManager riskManager, IPositionSizer positionSizer);

        /// <summary>
        /// Convert NT8 bar data to SDK format
        /// </summary>
        BarData ConvertToSdkBar(string symbol, DateTime time, double open, double high, double low, double close, long volume, int barSize);

        /// <summary>
        /// Convert NT8 account data to SDK format
        /// </summary>
        AccountInfo ConvertToSdkAccount(double equity, double buyingPower, double dailyPnL, double maxDrawdown, DateTime lastUpdate);

        /// <summary>
        /// Convert NT8 position data to SDK format
        /// </summary>
        Position ConvertToSdkPosition(string symbol, int quantity, double averagePrice, double unrealizedPnL, double realizedPnL, DateTime lastUpdate);

        /// <summary>
        /// Execute strategy intent through NT8
        /// </summary>
        void ExecuteIntent(StrategyIntent intent, SizingResult sizing);

        /// <summary>
        /// Handle order updates from NT8
        /// </summary>
        void OnOrderUpdate(string orderId, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, string orderState, DateTime time, string errorCode, string nativeError);

        /// <summary>
        /// Handle execution updates from NT8
        /// </summary>
        void OnExecutionUpdate(string executionId, string orderId, double price, int quantity, string marketPosition, DateTime time);
    }
}
