package dcrcash

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

//get wallet info result struct
type WalletInfo struct {
	DaemonConnected  bool    `json:"daemonconnected"`
	Unlocked         bool    `json:"unlocked"`
	TxFee            float64 `json:"txfee"`
	TicketFee        float64 `json:"ticketfee"`
	TicketPurchasing bool    `json:"ticketpurchasing"`
	VoteBits         uint16  `json:"votebits"`
	VoteBitsExtended string  `json:"votebitsextended"`
	VoteVersion      uint32  `json:"voteversion"`
	Voting           bool    `json:"voting"`
}

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

//set fee
type Setfeeresult struct {
	Result bool     `json:"result"`
	Error  RpcError `json:"error"`
	Id     int
}

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

//get block count
type Blockcountresult struct {
	Result uint64   `json:"result"`
	Error  RpcError `json:"error"`
	Id     int
}

type account struct {
	AccountName             string  `json:"accountname"`
	ImmatureCoinbaseRewards float64 `json:"immaturecoinbaserewards"`
	ImmatureStakeGeneration float64 `json:"immaturestakegeneration"`
	LockedByTickets         float64 `json:"lockedbytickets"`
	Spendable               float64 `json:"spendable"`
	Total                   float64 `json:"total"`
	Unconfirmed             float64 `json:"unconfirmed"`
	VotingAuthority         float64 `json:"votingauthority"`
}
type Accounts struct {
	Balances  []account `json:"balances"`
	Blockhash string    `json:"blockhash"`
}

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

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

// list  transactions since blockhash result struct
type Listtransactions struct {
	Account           string   `json:"account"`
	Address           string   `json:"address"`
	Amount            float64  `json:"amount"`
	Blockhash         string   `json:"blockhash"`
	Blockindex        uint64   `json:"blockindex"`
	Blocktime         uint64   `json:"blocktime"`
	Category          string   `json:"category"`
	Confirmations     uint64   `json:"confirmations"`
	Fee               float64  `json:"fee"`
	Generated         bool     `json:generated`
	Involveswatchonly bool     `json:"involveswatchonly"`
	Time              uint64   `json:"time"`
	Timereceived      uint64   `json:"timereceived"`
	Txid              string   `json:"txid"`
	Txtype            string   `json:"txtype"`
	Vout              uint64   `json:"vout"`
	WalletConflicts   []string `json:"walletconflicts"`
	Comment           string   `json:"comment"`
	Otheraccount      string   `json:"otheraccount"`
}

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

type scriptsig struct {
	Asm string
	Hex string
}

type scriptpubkey struct {
	Asm       string
	Hex       string
	ReqSigs   uint64
	Type      string
	Addresses []string
	Commitamt float64
}

type vin struct {
	Coinbase    string
	Stakebase   string
	Txid        string
	vout        uint64
	Tree        uint64
	Sequese     uint64
	Amountin    float64
	Blockheighe uint64
	Blockindex  uint64
	ScriptSig   scriptsig
}

type vout struct {
	Value        float64
	N            uint64
	Version      uint64
	ScriptPubkey scriptpubkey
}

type rawtx struct {
	Hex           string
	Txid          string
	Version       uint64
	Locktime      uint64
	Expiry        uint64
	Vin           []vin
	Vout          []vout
	blockhash     string
	blockheight   uint64
	blockindex    uint64
	tonfirmations uint64
	time          uint64
	blocktime     uint64
}

// get block info result struct
type BlockInfo struct {
	Hash              string
	Confirmations     uint64
	Size              uint64
	Height            uint64
	Version           uint64
	Merkleroot        string
	Stakerroot        string
	Tx                []string
	Rawtx             []rawtx
	Stx               []string
	Rawstx            []rawtx
	Time              uint64
	Nonce             uint64
	Votebits          uint64
	Finalstate        string
	Voters            uint64
	Freshstake        uint64
	Revocations       uint64
	Poolsize          uint64
	Bits              string
	Sbits             float64
	Difficulty        float64
	Extradata         string
	Stakeversion      uint64
	Previousblockhash string
	Nextblockhash     string
}

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

//list unspent info result struct
type UnspentInfo struct {
	Txid          string  `json:"txid"`
	Vout          uint64  `json:"vout"`
	Tree          uint64  `json:"tree"`
	Txtype        uint64  `json:"txtype"`
	Address       string  `json:"address"`
	Account       string  `json:"account"`
	ScriptPubKey  string  `json:"scriptpubkey"`
	RedeemScript  string  `json:"redeemscript"`
	Amount        float64 `json:"amount"`
	Confirmations uint64  `json:"confirmations"`
	Spendable     bool    `json:"spendable"`
}

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

/*type AccountsOfvalue struct {
	Account string  `json:"account"`
	Balance float64 `json:"balance"`
}*/

type AccountsOfvaluesResult struct {
	Result map[string]float64 `json:"result"`
	Error  RpcError           `json:"error"`
	Id     int                `json:"id"`
}

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