using System.Text.Json.Serialization;
using Newtonsoft.Json;

namespace Managing.Infrastructure.Evm.Models.Proxy;

public class Open
{
    [JsonProperty("direction")] public string Direction { get; set; }

    [JsonProperty("price")] public double Price { get; set; }

    [JsonProperty("quantity")] public double Quantity { get; set; }

    [JsonProperty("leverage")] public double Leverage { get; set; }

    [JsonProperty("status")] public string Status { get; set; }
}

public class GmxPosition
{
    [JsonProperty("id")] public string Id { get; set; }

    [JsonProperty("ticker")] public string Ticker { get; set; }

    [JsonProperty("direction")] public string Direction { get; set; }

    [JsonProperty("price")] public double Price { get; set; }

    [JsonProperty("quantity")] public double Quantity { get; set; }

    [JsonProperty("leverage")] public double Leverage { get; set; }

    [JsonProperty("status")] public string Status { get; set; }

    [JsonProperty("tradeType")] public string TradeType { get; set; }

    [JsonProperty("date")] public DateTime Date { get; set; }

    [JsonProperty("exchangeOrderId")] public string ExchangeOrderId { get; set; }

    [JsonProperty("pnl")] public double Pnl { get; set; }

    [JsonProperty("collateral")] public double Collateral { get; set; }

    [JsonProperty("markPrice")] public double? MarkPrice { get; set; }

    [JsonProperty("liquidationPrice")] public double? LiquidationPrice { get; set; }

    [JsonProperty("ProfitAndLoss")]
    [JsonPropertyName("ProfitAndLoss")]
    public GmxPositionProfitAndLoss ProfitAndLoss { get; set; }

    [JsonProperty("UiFees")]
    [JsonPropertyName("UiFees")]
    public double? UiFees { get; set; }

    [JsonProperty("GasFees")]
    [JsonPropertyName("GasFees")]
    public double? GasFees { get; set; }

    [JsonProperty("StopLoss")]
    [JsonPropertyName("StopLoss")]
    public GmxTrade StopLoss { get; set; }

    [JsonProperty("TakeProfit1")]
    [JsonPropertyName("TakeProfit1")]
    public GmxTrade TakeProfit1 { get; set; }

    [JsonProperty("Open")]
    [JsonPropertyName("Open")]
    public GmxTrade Open { get; set; }
}

public class GetGmxPositionsResponse : Web3ProxyBaseResponse
{
    [JsonProperty("positions")] public List<GmxPosition> Positions { get; set; }
}

public class GetGmxPositionHistoryResponse : Web3ProxyResponse
{
    [JsonProperty("positions")] public List<GmxPosition> Positions { get; set; }
    
    [JsonProperty("pageIndex")] public int PageIndex { get; set; }
    
    [JsonProperty("pageSize")] public int PageSize { get; set; }
    
    [JsonProperty("count")] public int Count { get; set; }
}

public class GmxPositionProfitAndLoss
{
    [JsonProperty("realized")] public double? Realized { get; set; }
    
    [JsonProperty("net")] public double? Net { get; set; }
    
    [JsonProperty("averageOpenPrice")] public double? AverageOpenPrice { get; set; }
}

public class StopLoss
{
    [JsonProperty("id")] public string Id { get; set; }

    [JsonProperty("ticker")] public string Ticker { get; set; }

    [JsonProperty("direction")] public string Direction { get; set; }

    [JsonProperty("price")] public double Price { get; set; }

    [JsonProperty("quantity")] public double Quantity { get; set; }

    [JsonProperty("leverage")] public int Leverage { get; set; }

    [JsonProperty("status")] public string Status { get; set; }

    [JsonProperty("tradeType")] public string TradeType { get; set; }

    [JsonProperty("date")] public DateTime Date { get; set; }

    [JsonProperty("exchangeOrderId")] public string ExchangeOrderId { get; set; }
}

public class TakeProfit1
{
    [JsonProperty("id")] public string Id { get; set; }

    [JsonProperty("ticker")] public string Ticker { get; set; }

    [JsonProperty("direction")] public string Direction { get; set; }

    [JsonProperty("price")] public double Price { get; set; }

    [JsonProperty("quantity")] public double Quantity { get; set; }

    [JsonProperty("leverage")] public int Leverage { get; set; }

    [JsonProperty("status")] public string Status { get; set; }

    [JsonProperty("tradeType")] public string TradeType { get; set; }

    [JsonProperty("date")] public DateTime Date { get; set; }

    [JsonProperty("exchangeOrderId")] public string ExchangeOrderId { get; set; }
}