/**
 * CoinAPI Market Data 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';

/**
 * The V1LastTrade model module.
 * @module model/V1LastTrade
 * @version v1
 */
class V1LastTrade {
    /**
     * Constructs a new <code>V1LastTrade</code>.
     * Represents the last executed transaction.
     * @alias module:model/V1LastTrade
     */
    constructor() { 
        
        V1LastTrade.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>V1LastTrade</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/V1LastTrade} obj Optional instance to populate.
     * @return {module:model/V1LastTrade} The populated <code>V1LastTrade</code> instance.
     */
    static constructFromObject(data, obj) {
        if (data) {
            obj = obj || new V1LastTrade();

            if (data.hasOwnProperty('time_exchange')) {
                obj['time_exchange'] = ApiClient.convertToType(data['time_exchange'], 'Date');
            }
            if (data.hasOwnProperty('time_coinapi')) {
                obj['time_coinapi'] = ApiClient.convertToType(data['time_coinapi'], 'Date');
            }
            if (data.hasOwnProperty('uuid')) {
                obj['uuid'] = ApiClient.convertToType(data['uuid'], 'String');
            }
            if (data.hasOwnProperty('price')) {
                obj['price'] = ApiClient.convertToType(data['price'], 'Number');
            }
            if (data.hasOwnProperty('size')) {
                obj['size'] = ApiClient.convertToType(data['size'], 'Number');
            }
            if (data.hasOwnProperty('taker_side')) {
                obj['taker_side'] = ApiClient.convertToType(data['taker_side'], 'String');
            }
        }
        return obj;
    }

    /**
     * Validates the JSON data with respect to <code>V1LastTrade</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>V1LastTrade</code>.
     */
    static validateJSON(data) {
        // ensure the json data is a string
        if (data['uuid'] && !(typeof data['uuid'] === 'string' || data['uuid'] instanceof String)) {
            throw new Error("Expected the field `uuid` to be a primitive type in the JSON string but got " + data['uuid']);
        }
        // ensure the json data is a string
        if (data['taker_side'] && !(typeof data['taker_side'] === 'string' || data['taker_side'] instanceof String)) {
            throw new Error("Expected the field `taker_side` to be a primitive type in the JSON string but got " + data['taker_side']);
        }

        return true;
    }


}



/**
 * The exchange time of the last trade.
 * @member {Date} time_exchange
 */
V1LastTrade.prototype['time_exchange'] = undefined;

/**
 * The CoinAPI time when the last trade was received.
 * @member {Date} time_coinapi
 */
V1LastTrade.prototype['time_coinapi'] = undefined;

/**
 * The UUID of the last trade.
 * @member {String} uuid
 */
V1LastTrade.prototype['uuid'] = undefined;

/**
 * The price of the last trade.
 * @member {Number} price
 */
V1LastTrade.prototype['price'] = undefined;

/**
 * The size of the last trade.
 * @member {Number} size
 */
V1LastTrade.prototype['size'] = undefined;

/**
 * The taker side of the last trade.
 * @member {String} taker_side
 */
V1LastTrade.prototype['taker_side'] = undefined;






export default V1LastTrade;

