/**
 * 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';
import OptionsStrike from './OptionsStrike';

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

            if (data.hasOwnProperty('asset_id_base')) {
                obj['asset_id_base'] = ApiClient.convertToType(data['asset_id_base'], 'String');
            }
            if (data.hasOwnProperty('asset_id_quote')) {
                obj['asset_id_quote'] = ApiClient.convertToType(data['asset_id_quote'], 'String');
            }
            if (data.hasOwnProperty('underlying_price')) {
                obj['underlying_price'] = ApiClient.convertToType(data['underlying_price'], 'Number');
            }
            if (data.hasOwnProperty('time_expiration')) {
                obj['time_expiration'] = ApiClient.convertToType(data['time_expiration'], 'Date');
            }
            if (data.hasOwnProperty('strikes')) {
                obj['strikes'] = ApiClient.convertToType(data['strikes'], [OptionsStrike]);
            }
        }
        return obj;
    }

    /**
     * Validates the JSON data with respect to <code>OptionsOptionExchangeGroup</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>OptionsOptionExchangeGroup</code>.
     */
    static validateJSON(data) {
        // ensure the json data is a string
        if (data['asset_id_base'] && !(typeof data['asset_id_base'] === 'string' || data['asset_id_base'] instanceof String)) {
            throw new Error("Expected the field `asset_id_base` to be a primitive type in the JSON string but got " + data['asset_id_base']);
        }
        // ensure the json data is a string
        if (data['asset_id_quote'] && !(typeof data['asset_id_quote'] === 'string' || data['asset_id_quote'] instanceof String)) {
            throw new Error("Expected the field `asset_id_quote` to be a primitive type in the JSON string but got " + data['asset_id_quote']);
        }
        if (data['strikes']) { // data not null
            // ensure the json data is an array
            if (!Array.isArray(data['strikes'])) {
                throw new Error("Expected the field `strikes` to be an array in the JSON data but got " + data['strikes']);
            }
            // validate the optional field `strikes` (array)
            for (const item of data['strikes']) {
                OptionsStrike.validateJSON(item);
            };
        }

        return true;
    }


}



/**
 * The base asset identifier.
 * @member {String} asset_id_base
 */
OptionsOptionExchangeGroup.prototype['asset_id_base'] = undefined;

/**
 * The quote asset identifier.
 * @member {String} asset_id_quote
 */
OptionsOptionExchangeGroup.prototype['asset_id_quote'] = undefined;

/**
 * The underlying price of the option.
 * @member {Number} underlying_price
 */
OptionsOptionExchangeGroup.prototype['underlying_price'] = undefined;

/**
 * The expiration time of the option.
 * @member {Date} time_expiration
 */
OptionsOptionExchangeGroup.prototype['time_expiration'] = undefined;

/**
 * The list of strikes available.
 * @member {Array.<module:model/OptionsStrike>} strikes
 */
OptionsOptionExchangeGroup.prototype['strikes'] = undefined;






export default OptionsOptionExchangeGroup;

