/* 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 {
    RosettaBlockMetadata2,
    RosettaBlockMetadata2FromJSON,
    RosettaBlockMetadata2FromJSONTyped,
    RosettaBlockMetadata2ToJSON,
    RosettaParentBlockIdentifier,
    RosettaParentBlockIdentifierFromJSON,
    RosettaParentBlockIdentifierFromJSONTyped,
    RosettaParentBlockIdentifierToJSON,
    RosettaTransaction,
    RosettaTransactionFromJSON,
    RosettaTransactionFromJSONTyped,
    RosettaTransactionToJSON,
} from './';

/**
 * Blocks contain an array of Transactions that occurred at a particular BlockIdentifier. A hard requirement for blocks returned by Rosetta implementations is that they MUST be inalterable: once a client has requested and received a block identified by a specific BlockIndentifier, all future calls for that same BlockIdentifier must return the same block contents.
 * @export
 * @interface RosettaBlock
 */
export interface RosettaBlock {
    /**
     * The block_identifier uniquely identifies a block in a particular network.
     * @type {object}
     * @memberof RosettaBlock
     */
    block_identifier: object;
    /**
     * 
     * @type {RosettaParentBlockIdentifier}
     * @memberof RosettaBlock
     */
    parent_block_identifier: RosettaParentBlockIdentifier;
    /**
     * The timestamp of the block in milliseconds since the Unix Epoch. The timestamp is stored in milliseconds because some blockchains produce blocks more often than once a second.
     * @type {number}
     * @memberof RosettaBlock
     */
    timestamp: number;
    /**
     * All the transactions in the block
     * @type {Array<RosettaTransaction>}
     * @memberof RosettaBlock
     */
    transactions: Array<RosettaTransaction>;
    /**
     * 
     * @type {RosettaBlockMetadata2}
     * @memberof RosettaBlock
     */
    metadata?: RosettaBlockMetadata2;
}

export function RosettaBlockFromJSON(json: any): RosettaBlock {
    return RosettaBlockFromJSONTyped(json, false);
}

export function RosettaBlockFromJSONTyped(json: any, ignoreDiscriminator: boolean): RosettaBlock {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'block_identifier': json['block_identifier'],
        'parent_block_identifier': RosettaParentBlockIdentifierFromJSON(json['parent_block_identifier']),
        'timestamp': json['timestamp'],
        'transactions': ((json['transactions'] as Array<any>).map(RosettaTransactionFromJSON)),
        'metadata': !exists(json, 'metadata') ? undefined : RosettaBlockMetadata2FromJSON(json['metadata']),
    };
}

export function RosettaBlockToJSON(value?: RosettaBlock | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'block_identifier': value.block_identifier,
        'parent_block_identifier': RosettaParentBlockIdentifierToJSON(value.parent_block_identifier),
        'timestamp': value.timestamp,
        'transactions': ((value.transactions as Array<any>).map(RosettaTransactionToJSON)),
        'metadata': RosettaBlockMetadata2ToJSON(value.metadata),
    };
}


