/**
 * Exchange Rates Historical REST API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 * Contact: support@apibricks.io
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */

import ApiClient from '../ApiClient';
import V1ChainNetworkAddress from './V1ChainNetworkAddress';

/**
 * The V1Asset model module.
 * @module model/V1Asset
 * @version v1
 */
class V1Asset {
    /**
     * Constructs a new <code>V1Asset</code>.
     * Represents an asset.
     * @alias module:model/V1Asset
     */
    constructor() { 
        
        V1Asset.initialize(this);
    }

    /**
     * Initializes the fields of this object.
     * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
     * Only for internal use.
     */
    static initialize(obj) { 
    }

    /**
     * Constructs a <code>V1Asset</code> from a plain JavaScript object, optionally creating a new instance.
     * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
     * @param {Object} data The plain JavaScript object bearing properties of interest.
     * @param {module:model/V1Asset} obj Optional instance to populate.
     * @return {module:model/V1Asset} The populated <code>V1Asset</code> instance.
     */
    static constructFromObject(data, obj) {
        if (data) {
            obj = obj || new V1Asset();

            if (data.hasOwnProperty('asset_id')) {
                obj['asset_id'] = ApiClient.convertToType(data['asset_id'], 'String');
            }
            if (data.hasOwnProperty('name')) {
                obj['name'] = ApiClient.convertToType(data['name'], 'String');
            }
            if (data.hasOwnProperty('type_is_crypto')) {
                obj['type_is_crypto'] = ApiClient.convertToType(data['type_is_crypto'], 'Number');
            }
            if (data.hasOwnProperty('data_quote_start')) {
                obj['data_quote_start'] = ApiClient.convertToType(data['data_quote_start'], 'Date');
            }
            if (data.hasOwnProperty('data_quote_end')) {
                obj['data_quote_end'] = ApiClient.convertToType(data['data_quote_end'], 'Date');
            }
            if (data.hasOwnProperty('data_orderbook_start')) {
                obj['data_orderbook_start'] = ApiClient.convertToType(data['data_orderbook_start'], 'Date');
            }
            if (data.hasOwnProperty('data_orderbook_end')) {
                obj['data_orderbook_end'] = ApiClient.convertToType(data['data_orderbook_end'], 'Date');
            }
            if (data.hasOwnProperty('data_trade_start')) {
                obj['data_trade_start'] = ApiClient.convertToType(data['data_trade_start'], 'Date');
            }
            if (data.hasOwnProperty('data_trade_end')) {
                obj['data_trade_end'] = ApiClient.convertToType(data['data_trade_end'], 'Date');
            }
            if (data.hasOwnProperty('data_symbols_count')) {
                obj['data_symbols_count'] = ApiClient.convertToType(data['data_symbols_count'], 'Number');
            }
            if (data.hasOwnProperty('volume_1hrs_usd')) {
                obj['volume_1hrs_usd'] = ApiClient.convertToType(data['volume_1hrs_usd'], 'Number');
            }
            if (data.hasOwnProperty('volume_1day_usd')) {
                obj['volume_1day_usd'] = ApiClient.convertToType(data['volume_1day_usd'], 'Number');
            }
            if (data.hasOwnProperty('volume_1mth_usd')) {
                obj['volume_1mth_usd'] = ApiClient.convertToType(data['volume_1mth_usd'], 'Number');
            }
            if (data.hasOwnProperty('price_usd')) {
                obj['price_usd'] = ApiClient.convertToType(data['price_usd'], 'Number');
            }
            if (data.hasOwnProperty('id_icon')) {
                obj['id_icon'] = ApiClient.convertToType(data['id_icon'], 'String');
            }
            if (data.hasOwnProperty('supply_current')) {
                obj['supply_current'] = ApiClient.convertToType(data['supply_current'], 'Number');
            }
            if (data.hasOwnProperty('supply_total')) {
                obj['supply_total'] = ApiClient.convertToType(data['supply_total'], 'Number');
            }
            if (data.hasOwnProperty('supply_max')) {
                obj['supply_max'] = ApiClient.convertToType(data['supply_max'], 'Number');
            }
            if (data.hasOwnProperty('chain_addresses')) {
                obj['chain_addresses'] = ApiClient.convertToType(data['chain_addresses'], [V1ChainNetworkAddress]);
            }
            if (data.hasOwnProperty('data_start')) {
                obj['data_start'] = ApiClient.convertToType(data['data_start'], 'String');
            }
            if (data.hasOwnProperty('data_end')) {
                obj['data_end'] = ApiClient.convertToType(data['data_end'], 'String');
            }
        }
        return obj;
    }

    /**
     * Validates the JSON data with respect to <code>V1Asset</code>.
     * @param {Object} data The plain JavaScript object bearing properties of interest.
     * @return {boolean} to indicate whether the JSON data is valid with respect to <code>V1Asset</code>.
     */
    static validateJSON(data) {
        // ensure the json data is a string
        if (data['asset_id'] && !(typeof data['asset_id'] === 'string' || data['asset_id'] instanceof String)) {
            throw new Error("Expected the field `asset_id` to be a primitive type in the JSON string but got " + data['asset_id']);
        }
        // ensure the json data is a string
        if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
            throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
        }
        // ensure the json data is a string
        if (data['id_icon'] && !(typeof data['id_icon'] === 'string' || data['id_icon'] instanceof String)) {
            throw new Error("Expected the field `id_icon` to be a primitive type in the JSON string but got " + data['id_icon']);
        }
        if (data['chain_addresses']) { // data not null
            // ensure the json data is an array
            if (!Array.isArray(data['chain_addresses'])) {
                throw new Error("Expected the field `chain_addresses` to be an array in the JSON data but got " + data['chain_addresses']);
            }
            // validate the optional field `chain_addresses` (array)
            for (const item of data['chain_addresses']) {
                V1ChainNetworkAddress.validateJSON(item);
            };
        }
        // ensure the json data is a string
        if (data['data_start'] && !(typeof data['data_start'] === 'string' || data['data_start'] instanceof String)) {
            throw new Error("Expected the field `data_start` to be a primitive type in the JSON string but got " + data['data_start']);
        }
        // ensure the json data is a string
        if (data['data_end'] && !(typeof data['data_end'] === 'string' || data['data_end'] instanceof String)) {
            throw new Error("Expected the field `data_end` to be a primitive type in the JSON string but got " + data['data_end']);
        }

        return true;
    }


}



/**
 * Gets or sets the asset ID.
 * @member {String} asset_id
 */
V1Asset.prototype['asset_id'] = undefined;

/**
 * Gets or sets the name of the asset.
 * @member {String} name
 */
V1Asset.prototype['name'] = undefined;

/**
 * Gets or sets a value indicating whether the asset is a cryptocurrency.
 * @member {Number} type_is_crypto
 */
V1Asset.prototype['type_is_crypto'] = undefined;

/**
 * Gets or sets the start date of quote data.
 * @member {Date} data_quote_start
 */
V1Asset.prototype['data_quote_start'] = undefined;

/**
 * Gets or sets the end date of quote data.
 * @member {Date} data_quote_end
 */
V1Asset.prototype['data_quote_end'] = undefined;

/**
 * Gets or sets the start date of order book data.
 * @member {Date} data_orderbook_start
 */
V1Asset.prototype['data_orderbook_start'] = undefined;

/**
 * Gets or sets the end date of order book data.
 * @member {Date} data_orderbook_end
 */
V1Asset.prototype['data_orderbook_end'] = undefined;

/**
 * Gets or sets the start date of trade data.
 * @member {Date} data_trade_start
 */
V1Asset.prototype['data_trade_start'] = undefined;

/**
 * Gets or sets the end date of trade data.
 * @member {Date} data_trade_end
 */
V1Asset.prototype['data_trade_end'] = undefined;

/**
 * Gets or sets the number of symbols.
 * @member {Number} data_symbols_count
 */
V1Asset.prototype['data_symbols_count'] = undefined;

/**
 * Gets or sets the USD volume in the last 1 hour.
 * @member {Number} volume_1hrs_usd
 */
V1Asset.prototype['volume_1hrs_usd'] = undefined;

/**
 * Gets or sets the USD volume in the last 1 day.
 * @member {Number} volume_1day_usd
 */
V1Asset.prototype['volume_1day_usd'] = undefined;

/**
 * Gets or sets the USD volume in the last 1 month.
 * @member {Number} volume_1mth_usd
 */
V1Asset.prototype['volume_1mth_usd'] = undefined;

/**
 * Gets or sets the USD price of the asset.
 * @member {Number} price_usd
 */
V1Asset.prototype['price_usd'] = undefined;

/**
 * Gets or sets the ID of the icon for the asset.
 * @member {String} id_icon
 */
V1Asset.prototype['id_icon'] = undefined;

/**
 * Gets or sets the current supply of the asset.
 * @member {Number} supply_current
 */
V1Asset.prototype['supply_current'] = undefined;

/**
 * Gets or sets the total supply of the asset.
 * @member {Number} supply_total
 */
V1Asset.prototype['supply_total'] = undefined;

/**
 * Gets or sets the maximum supply of the asset.
 * @member {Number} supply_max
 */
V1Asset.prototype['supply_max'] = undefined;

/**
 * 
 * @member {Array.<module:model/V1ChainNetworkAddress>} chain_addresses
 */
V1Asset.prototype['chain_addresses'] = undefined;

/**
 * @member {String} data_start
 */
V1Asset.prototype['data_start'] = undefined;

/**
 * @member {String} data_end
 */
V1Asset.prototype['data_end'] = undefined;






export default V1Asset;

