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

            if (data.hasOwnProperty('symbol_id')) {
                obj['symbol_id'] = ApiClient.convertToType(data['symbol_id'], 'String');
            }
            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');
            }
            if (data.hasOwnProperty('id_trade')) {
                obj['id_trade'] = ApiClient.convertToType(data['id_trade'], 'String');
            }
            if (data.hasOwnProperty('id_order_maker')) {
                obj['id_order_maker'] = ApiClient.convertToType(data['id_order_maker'], 'String');
            }
            if (data.hasOwnProperty('id_order_taker')) {
                obj['id_order_taker'] = ApiClient.convertToType(data['id_order_taker'], 'String');
            }
        }
        return obj;
    }

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

        return true;
    }


}



/**
 * The symbol identifier.
 * @member {String} symbol_id
 */
V1Trade.prototype['symbol_id'] = undefined;

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

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

/**
 * The unique identifier for the trade.
 * @member {String} uuid
 */
V1Trade.prototype['uuid'] = undefined;

/**
 * The price of the transaction.
 * @member {Number} price
 */
V1Trade.prototype['price'] = undefined;

/**
 * The base asset amount traded in the transaction.
 * @member {Number} size
 */
V1Trade.prototype['size'] = undefined;

/**
 * The aggressor side of the transaction (BUY/SELL/BUY_ESTIMATED/SELL_ESTIMATED/UNKNOWN).
 * @member {String} taker_side
 */
V1Trade.prototype['taker_side'] = undefined;

/**
 * The trade identifier.
 * @member {String} id_trade
 */
V1Trade.prototype['id_trade'] = undefined;

/**
 * The order maker identifier.
 * @member {String} id_order_maker
 */
V1Trade.prototype['id_order_maker'] = undefined;

/**
 * The order taker identifier.
 * @member {String} id_order_taker
 */
V1Trade.prototype['id_order_taker'] = undefined;






export default V1Trade;

