package com.honey.honey.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.List;

/**
 * Response from external GET api/v1/withdrawals-info/{payment_id}.
 * status in payment_list: "-1" PROCESSING, "0" WAITING, "1" COMPLETED, "2" CANCELLED.
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class WithdrawalInfoApiResponse {

    @JsonProperty("request_info")
    private RequestInfo requestInfo;

    @JsonProperty("result")
    private Result result;

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class RequestInfo {
        @JsonProperty("error_code")
        private Integer errorCode;
        @JsonProperty("error_message")
        private String errorMessage;
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Result {
        @JsonProperty("payment_list")
        private List<PaymentItem> paymentList;
        @JsonProperty("hash")
        private String hash;
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class PaymentItem {
        @JsonProperty("payment_id")
        private Integer paymentId;
        @JsonProperty("user_id")
        private Integer userId;
        @JsonProperty("name")
        private String name;
        @JsonProperty("ticker")
        private String ticker;
        @JsonProperty("wallet")
        private String wallet;
        @JsonProperty("amount_usd")
        private Double amountUsd;
        @JsonProperty("amount_coins")
        private String amountCoins;
        @JsonProperty("amount_coins_fee")
        private String amountCoinsFee;
        @JsonProperty("txhash")
        private String txhash;
        @JsonProperty("status")
        private String status; // "-1" PROCESSING, "0" WAITING, "1" COMPLETED, "2" CANCELLED
        @JsonProperty("status_text")
        private String statusText;
        @JsonProperty("date_added")
        private String dateAdded;
        @JsonProperty("last_update")
        private String lastUpdate;
    }
}
