package com.msgilligan.bitcoinj.json.pojo;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.bitcoinj.core.Sha256Hash;

import java.math.BigDecimal;

/**
 * POJO for `getblockchaininfo` RPC response.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class BlockChainInfo {
    private final String      chain;
    private final int         blocks;
    private final int         headers;
    private final Sha256Hash  bestBlockHash;
    private final BigDecimal  difficulty;
    private final BigDecimal  verificationProgress;
    private final byte[]      chainWork;

    @JsonCreator
    public BlockChainInfo(@JsonProperty("chain")            String chain,
                          @JsonProperty("blocks")           int blocks,
                          @JsonProperty("headers")          int headers,
                          @JsonProperty("bestblockhash")    Sha256Hash bestBlockHash,
                          @JsonProperty("chain")            BigDecimal difficulty,
                          @JsonProperty("chain")            BigDecimal verificationProgress,
                          @JsonProperty("chain")            byte[] chainWork) {
        this.chain = chain;
        this.blocks = blocks;
        this.headers = headers;
        this.bestBlockHash = bestBlockHash;
        this.difficulty = difficulty;
        this.verificationProgress = verificationProgress;
        this.chainWork = chainWork;
    }

    public String getChain() {
        return chain;
    }

    public int getBlocks() {
        return blocks;
    }

    public int getHeaders() {
        return headers;
    }

    public Sha256Hash getBestBlockHash() {
        return bestBlockHash;
    }

    public BigDecimal getDifficulty() {
        return difficulty;
    }

    public BigDecimal getVerificationProgress() {
        return verificationProgress;
    }

    public byte[] getChainWork() {
        return chainWork;
    }
}

@@ -989,16 +989,20 @@
 ckhash%22)
+    
     Sha2
@@ -1060,32 +1060,36 @@
 onProperty(%22
-chain
+difficulty
 %22)
- 
            B
@@ -1151,34 +1151,38 @@
 operty(%22
-chain%22)           
+verificationProgress%22)
  BigDeci
@@ -1245,32 +1245,36 @@
 nProperty(%22chain
+Work
 %22)            by

Fix incorrectly-named JsonProperty annotations