/* eslint-disable @typescript-eslint/no-namespace */
export namespace V2 {
    export type Status = {
        blockbook: BlockbookInfo;
        backend: BackendInfo;
    };

    export type BlockbookInfo = {
        coin: string;
        host: string;
        version: string;
        gitCommit: string;
        buildTime: string;
        syncMode: boolean;
        initialSync: boolean;
        inSync: boolean;
        bestHeight: number;
        lastBlockTime: string;
        inSyncMempool: boolean;
        mempoolSize: number;
        decimals: number;
        dbSize: number;
        about: string;
    };

    export type BackendInfo = {
        chain: string;
        blocks: number;
        headers: number;
        bestBlockHash: string;
        difficulty: string;
        sizeOnDisk: number;
        version: string;
        subversion: string;
        protocolVersion: string;
        warnings: string;
    };

    export type BlockHash = {
        blockHash: string;
    };

    export type Tx = {
        txid: string;
        version: number;
        blockHash: string;
        blockHeight: number;
        confirmations: number;
        blockTime: number;
        value: string;
        valueIn: string;
        fees: string;
        hex: string;
        vin: TxInput[];
        vout: TxOutput[];
    };

    export type TxInput = {
        txid: string;
        vout: number;
        sequence: number;
        n: number;
        addresses: string[];
        isAddress: boolean;
        value: string;
        hex: string;
    };

    export type TxOutput = {
        value: string;
        n: number;
        hex: string;
        addresses: string[];
        spent: boolean;
        isAddress: boolean;
    };

    export type AddressResult = {
        page: number;
        totalPages: number;
        itemsOnPage: number;
        address: string;
        balance: string;
        totalReceived: string;
        totalSent: string;
        unconfirmedBalance: string;
        unconfirmedTxs: number;
        txs: number;
        txids?: string[];
        transactions?: TxLight[] | Tx[];
    };

    export type TxLight = {
        txid: string;
        vin: TxInputLight[];
        vout: TxOutputLight[];
    };

    export type TxInputLight = {
        n: number;
        addresses: string[];
        isAddress: boolean;
        value: string;
    };

    export type TxOutputLight = {
        value: string;
        n: number;
        addresses: string[];
        isAddress: boolean;
    };

    export type Block = {
        page: number;
        totalPages: number;
        itemsOnPage: number;
        hash: string;
        previousBlockHash: string;
        nextBlockHash: string;
        height: number;
        confirmations: number;
        size: number;
        time: number;
        version: number;
        merkleRoot: string;
        nonce: string;
        bits: string;
        difficulty: string;
        txCount: number;
        txs: BlockTx[];
    };

    export type BlockTx = {
        txid: string;
        blockHash: string;
        blockHeight: number;
        confirmations: number;
        blockTime: number;
        value: string;
        valueIn: string;
        fees: string;
        vin: BlockTxInput[];
        vout: BlockTxOutput[];
    };

    export type BlockTxInput = {
        n: number;
        addresses: string[];
        isAddress: boolean;
        value: string;
    };

    export type BlockTxOutput = {
        value: string;
        n: number;
        spent: boolean;
        addresses: string[];
        isAddress: boolean;
    };
}
