/* tslint:disable */
/* eslint-disable */
/**
 * Stacks 2.0 Blockchain API
 * This is the documentation for the Stacks 2.0 Blockchain API.  It is comprised of two parts; the Stacks Blockchain API and the Stacks Core API.  [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/614feab5c108d292bffa#?env%5BStacks%20Blockchain%20API%5D=W3sia2V5Ijoic3R4X2FkZHJlc3MiLCJ2YWx1ZSI6IlNUMlRKUkhESE1ZQlE0MTdIRkIwQkRYNDMwVFFBNVBYUlg2NDk1RzFWIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJibG9ja19pZCIsInZhbHVlIjoiMHgiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6Im9mZnNldCIsInZhbHVlIjoiMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfdHgiLCJ2YWx1ZSI6IjIwMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfYmxvY2siLCJ2YWx1ZSI6IjMwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJ0eF9pZCIsInZhbHVlIjoiMHg1NDA5MGMxNmE3MDJiNzUzYjQzMTE0ZTg4NGJjMTlhODBhNzk2MzhmZDQ0OWE0MGY4MDY4Y2RmMDAzY2RlNmUwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9pZCIsInZhbHVlIjoiU1RKVFhFSlBKUFBWRE5BOUIwNTJOU1JSQkdRQ0ZOS1ZTMTc4VkdIMS5oZWxsb193b3JsZFxuIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJidGNfYWRkcmVzcyIsInZhbHVlIjoiYWJjIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9hZGRyZXNzIiwidmFsdWUiOiJTVEpUWEVKUEpQUFZETkE5QjA1Mk5TUlJCR1FDRk5LVlMxNzhWR0gxIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9uYW1lIiwidmFsdWUiOiJoZWxsb193b3JsZCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWFwIiwidmFsdWUiOiJzdG9yZSIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWV0aG9kIiwidmFsdWUiOiJnZXQtdmFsdWUiLCJlbmFibGVkIjp0cnVlfV0=) 
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { exists, mapValues } from '../runtime';
import {
    RosettaAccountBalanceResponseMetadata,
    RosettaAccountBalanceResponseMetadataFromJSON,
    RosettaAccountBalanceResponseMetadataFromJSONTyped,
    RosettaAccountBalanceResponseMetadataToJSON,
    RosettaAmount,
    RosettaAmountFromJSON,
    RosettaAmountFromJSONTyped,
    RosettaAmountToJSON,
    RosettaCoin,
    RosettaCoinFromJSON,
    RosettaCoinFromJSONTyped,
    RosettaCoinToJSON,
} from './';

/**
 * An AccountBalanceResponse is returned on the /account/balance endpoint. If an account has a balance for each AccountIdentifier describing it (ex: an ERC-20 token balance on a few smart contracts), an account balance request must be made with each AccountIdentifier.
 * @export
 * @interface RosettaAccountBalanceResponse
 */
export interface RosettaAccountBalanceResponse {
    /**
     * The block_identifier uniquely identifies a block in a particular network.
     * @type {object}
     * @memberof RosettaAccountBalanceResponse
     */
    block_identifier: object;
    /**
     * A single account balance may have multiple currencies
     * @type {Array<RosettaAmount>}
     * @memberof RosettaAccountBalanceResponse
     */
    balances: Array<RosettaAmount>;
    /**
     * If a blockchain is UTXO-based, all unspent Coins owned by an account_identifier should be returned alongside the balance. It is highly recommended to populate this field so that users of the Rosetta API implementation don't need to maintain their own indexer to track their UTXOs.
     * @type {Array<RosettaCoin>}
     * @memberof RosettaAccountBalanceResponse
     */
    coins?: Array<RosettaCoin>;
    /**
     * 
     * @type {RosettaAccountBalanceResponseMetadata}
     * @memberof RosettaAccountBalanceResponse
     */
    metadata?: RosettaAccountBalanceResponseMetadata;
}

export function RosettaAccountBalanceResponseFromJSON(json: any): RosettaAccountBalanceResponse {
    return RosettaAccountBalanceResponseFromJSONTyped(json, false);
}

export function RosettaAccountBalanceResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): RosettaAccountBalanceResponse {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'block_identifier': json['block_identifier'],
        'balances': ((json['balances'] as Array<any>).map(RosettaAmountFromJSON)),
        'coins': !exists(json, 'coins') ? undefined : ((json['coins'] as Array<any>).map(RosettaCoinFromJSON)),
        'metadata': !exists(json, 'metadata') ? undefined : RosettaAccountBalanceResponseMetadataFromJSON(json['metadata']),
    };
}

export function RosettaAccountBalanceResponseToJSON(value?: RosettaAccountBalanceResponse | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'block_identifier': value.block_identifier,
        'balances': ((value.balances as Array<any>).map(RosettaAmountToJSON)),
        'coins': value.coins === undefined ? undefined : ((value.coins as Array<any>).map(RosettaCoinToJSON)),
        'metadata': RosettaAccountBalanceResponseMetadataToJSON(value.metadata),
    };
}


