package bitcoin

//  rpc  error struct
type RpcError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

//  rpc  common result struct
type RpcResult struct {
	Result string   `json:"result"`
	Error  RpcError `json:"error"`
	Id     string   `json:"id"`
}

// get block info result struct
type BlockInfo struct {
	Hash              string
	Confirmations     uint64
	Size              uint64
	Height            uint64
	Version           uint64
	VersionHex        string
	Merkleroot        string
	Tx                []string
	Time              uint64
	Mediantime        uint64
	Nonce             uint64
	Bits              string
	Difficulty        float64
	Chainwork         string
	Previousblockhash string
	Nextblockhash     string
}

type BlockResult struct {
	Result BlockInfo `json:"result"`
	Error  RpcError  `json:"error"`
	Id     string    `json:"id"`
}

// list  transactions since blockhash result struct
type Listtransactions struct {
	Account       string  `json:"account"`
	Address       string  `json:"address"`
	Category      string  `json:"category"`
	Amount        float64 `json:"amount"`
	Vout          uint64  `json:"vout"`
	Fee           float64 `json:"fee":`
	Confirmations uint64  `json:"confirmations"`
	Blockhash     string  `json:"blockhash"`
	Blockindex    uint64  `json:"blockindex"`
	Blocktime     uint64  `json:"blocktime"`
	Txid          string  `json:"txid"`
	Time          uint64  `json:"time"`
	Timereceived  uint64  `json:"timereceived"`
	Abandoned     bool    `json:"abandoned"`
	Label         string  `json:"label"`
	Comment       string  `json:"comment"`
	To            string  `json:"to"`
}

type listtransactions struct {
	Transactions []Listtransactions `json: "transactions"`
	Lastblock    string             `json: "lastblock"`
}

type Listtransactionsresult struct {
	Result listtransactions `json:"result"`
	Error  RpcError         `json:"error"`
	Id     string           `json:"id"`
}

//get Balance result struct
type BalanceResult struct {
	Result float64  `json:"result"`
	Error  RpcError `json:"error"`
	Id     string   `json:"id"`
}

//get block count
type Blockcountresult struct {
	Result uint64
	Error  RpcError
	Id     string
}

//set fee
type Setfeeresult struct {
	Result bool
	Error  RpcError
	Id     string
}

//get wallet info result struct
type walletInfo struct {
	Walletversion       uint64
	Balance             float64
	Unconfirmed_balance float64
	Immature_balance    float64
	Txcount             uint64
	Keypoololdest       uint64
	Keypoolsize         uint64
	Unlocked_until      uint64
	Paytxfee            float64
}

type WalletinfoResult struct {
	Result walletInfo `json:"result"`
	Error  RpcError   `json:"error"`
	Id     string     `json:"id"`
}

//list unspent info result struct
type UnspentInfo struct {
	Txid          string
	Vout          uint64
	Address       string
	Account       string
	ScriptPubKey  string
	Amount        float64
	Confirmations uint64
	RedeemScript  string
	Spendable     bool
	Solvable      bool
}

//  RpcUnspentResult struct
type RpcUnspentResult struct {
	Result []UnspentInfo `json:"result"`
	Error  RpcError      `json:"error"`
	Id     string        `json:"id"`
}

