using System;
using System.Threading.Tasks;

namespace NT8.Core.OMS
{
    /// <summary>
    /// NinjaTrader 8 order adapter interface - provides abstraction layer between OMS and NT8
    /// </summary>
    public interface INT8OrderAdapter : IDisposable
    {
        /// <summary>
        /// Submit order to NinjaTrader 8
        /// </summary>
        /// <param name="request">Order request to submit</param>
        /// <returns>True if submission successful, false otherwise</returns>
        Task<bool> SubmitOrderAsync(OrderRequest request);

        /// <summary>
        /// Modify existing order in NinjaTrader 8
        /// </summary>
        /// <param name="modification">Order modification parameters</param>
        /// <returns>True if modification successful, false otherwise</returns>
        Task<bool> ModifyOrderAsync(OrderModification modification);

        /// <summary>
        /// Cancel order in NinjaTrader 8
        /// </summary>
        /// <param name="cancellation">Order cancellation request</param>
        /// <returns>True if cancellation successful, false otherwise</returns>
        Task<bool> CancelOrderAsync(OrderCancellation cancellation);

        /// <summary>
        /// Register callback for order status updates from NinjaTrader 8
        /// </summary>
        /// <param name="callback">Callback function to receive order updates</param>
        void RegisterOrderCallback(Action<OrderStatus> callback);

        /// <summary>
        /// Unregister callback for order status updates
        /// </summary>
        /// <param name="callback">Callback function to unregister</param>
        void UnregisterOrderCallback(Action<OrderStatus> callback);

        /// <summary>
        /// Connect to NinjaTrader 8
        /// </summary>
        /// <returns>True if connection successful, false otherwise</returns>
        Task<bool> ConnectAsync();

        /// <summary>
        /// Disconnect from NinjaTrader 8
        /// </summary>
        /// <returns>True if disconnection successful, false otherwise</returns>
        Task<bool> DisconnectAsync();
    }
}
