package com.honey.honey.dto;

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

/**
 * Response from external POST api/v1/withdrawal.
 * Success: result.payment present. Business error: result.error with error_code 1 (wallet invalid) or other.
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class WithdrawalApiResponse {

    @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")
        private Payment payment;
        @JsonProperty("error")
        private ResultError error;
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Payment {
        @JsonProperty("payment_id")
        private Integer paymentId;
        @JsonProperty("ticker")
        private String ticker;
        @JsonProperty("amount_coins")
        private String amountCoins;
        @JsonProperty("comission_coins")
        private String comissionCoins;
        @JsonProperty("amount_to_send")
        private String amountToSend;
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class ResultError {
        @JsonProperty("error_code")
        private Integer errorCode;
        @JsonProperty("error_text")
        private String errorText;
    }
}
