/**
 * FinFeedAPI Stock 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 TradeTradeModel model module.
 * @module model/TradeTradeModel
 * @version v1
 */
class TradeTradeModel {
    /**
     * Constructs a new <code>TradeTradeModel</code>.
     * Represents the response DTO for a single trade event (report or break).
     * @alias module:model/TradeTradeModel
     */
    constructor() { 
        
        TradeTradeModel.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>TradeTradeModel</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/TradeTradeModel} obj Optional instance to populate.
     * @return {module:model/TradeTradeModel} The populated <code>TradeTradeModel</code> instance.
     */
    static constructFromObject(data, obj) {
        if (data) {
            obj = obj || new TradeTradeModel();

            if (data.hasOwnProperty('is_trade_break')) {
                obj['is_trade_break'] = ApiClient.convertToType(data['is_trade_break'], 'Boolean');
            }
            if (data.hasOwnProperty('symbol')) {
                obj['symbol'] = ApiClient.convertToType(data['symbol'], 'String');
            }
            if (data.hasOwnProperty('timestamp_nanos')) {
                obj['timestamp_nanos'] = ApiClient.convertToType(data['timestamp_nanos'], 'Number');
            }
            if (data.hasOwnProperty('timestamp')) {
                obj['timestamp'] = ApiClient.convertToType(data['timestamp'], 'Date');
            }
            if (data.hasOwnProperty('size')) {
                obj['size'] = ApiClient.convertToType(data['size'], 'Number');
            }
            if (data.hasOwnProperty('price')) {
                obj['price'] = ApiClient.convertToType(data['price'], 'Number');
            }
            if (data.hasOwnProperty('trade_id')) {
                obj['trade_id'] = ApiClient.convertToType(data['trade_id'], 'Number');
            }
            if (data.hasOwnProperty('is_intermarket_sweep')) {
                obj['is_intermarket_sweep'] = ApiClient.convertToType(data['is_intermarket_sweep'], 'Boolean');
            }
            if (data.hasOwnProperty('is_extended_hours_trade')) {
                obj['is_extended_hours_trade'] = ApiClient.convertToType(data['is_extended_hours_trade'], 'Boolean');
            }
            if (data.hasOwnProperty('is_odd_lot_trade')) {
                obj['is_odd_lot_trade'] = ApiClient.convertToType(data['is_odd_lot_trade'], 'Boolean');
            }
            if (data.hasOwnProperty('is_trade_through_exempt')) {
                obj['is_trade_through_exempt'] = ApiClient.convertToType(data['is_trade_through_exempt'], 'Boolean');
            }
            if (data.hasOwnProperty('is_single_price_cross_trade')) {
                obj['is_single_price_cross_trade'] = ApiClient.convertToType(data['is_single_price_cross_trade'], 'Boolean');
            }
        }
        return obj;
    }

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

        return true;
    }


}



/**
 * Indicates if this record represents a trade break (true) or a trade report (false).
 * @member {Boolean} is_trade_break
 */
TradeTradeModel.prototype['is_trade_break'] = undefined;

/**
 * The stock symbol.
 * @member {String} symbol
 */
TradeTradeModel.prototype['symbol'] = undefined;

/**
 * Original timestamp in nanoseconds since epoch.
 * @member {Number} timestamp_nanos
 */
TradeTradeModel.prototype['timestamp_nanos'] = undefined;

/**
 * Time when the event was recorded as DateTime (UTC).
 * @member {Date} timestamp
 */
TradeTradeModel.prototype['timestamp'] = undefined;

/**
 * Trade volume (or break volume) in number of shares.
 * @member {Number} size
 */
TradeTradeModel.prototype['size'] = undefined;

/**
 * Trade price (or break price) as decimal.
 * @member {Number} price
 */
TradeTradeModel.prototype['price'] = undefined;

/**
 * IEX trade identifier (same for report and its corresponding break).
 * @member {Number} trade_id
 */
TradeTradeModel.prototype['trade_id'] = undefined;

/**
 * Bit 7 (Mask 0x80): Intermarket Sweep Flag. True: Intermarket Sweep Order (\"ISO\"). False: Non-Intermarket Sweep Order.
 * @member {Boolean} is_intermarket_sweep
 */
TradeTradeModel.prototype['is_intermarket_sweep'] = undefined;

/**
 * Bit 6 (Mask 0x40): Extended Hours Flag. True: Extended Hours Trade (i.e., Form T sale condition). False: Regular Market Session Trade.
 * @member {Boolean} is_extended_hours_trade
 */
TradeTradeModel.prototype['is_extended_hours_trade'] = undefined;

/**
 * Bit 5 (Mask 0x20): Odd Lot Flag. True: Odd Lot Trade. False: Round or Mixed Lot Trade.
 * @member {Boolean} is_odd_lot_trade
 */
TradeTradeModel.prototype['is_odd_lot_trade'] = undefined;

/**
 * Bit 4 (Mask 0x10): Trade Through Exempt Flag. True: Trade is not subject to Rule 611 (Trade Through) of SEC Reg. NMS. False: Trade is subject to Rule 611 (Trade Through) of SEC Reg. NMS. Applied when the taking order was an ISO that traded through a protected quotation, OR the NBBO was crossed at the time of the trade, OR the trade occurred through a self-helped venue's quotation, OR the trade was a single-price cross.
 * @member {Boolean} is_trade_through_exempt
 */
TradeTradeModel.prototype['is_trade_through_exempt'] = undefined;

/**
 * Bit 3 (Mask 0x08): Single-price Cross Trade Flag. True: Trade resulting from a single-price cross. False: Execution during continuous trading.
 * @member {Boolean} is_single_price_cross_trade
 */
TradeTradeModel.prototype['is_single_price_cross_trade'] = undefined;






export default TradeTradeModel;

