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

            if (data.hasOwnProperty('period_id')) {
                obj['period_id'] = ApiClient.convertToType(data['period_id'], 'String');
            }
            if (data.hasOwnProperty('length_seconds')) {
                obj['length_seconds'] = ApiClient.convertToType(data['length_seconds'], 'Number');
            }
            if (data.hasOwnProperty('length_months')) {
                obj['length_months'] = ApiClient.convertToType(data['length_months'], 'Number');
            }
            if (data.hasOwnProperty('unit_count')) {
                obj['unit_count'] = ApiClient.convertToType(data['unit_count'], 'Number');
            }
            if (data.hasOwnProperty('unit_name')) {
                obj['unit_name'] = ApiClient.convertToType(data['unit_name'], 'String');
            }
            if (data.hasOwnProperty('display_name')) {
                obj['display_name'] = ApiClient.convertToType(data['display_name'], 'String');
            }
        }
        return obj;
    }

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

        return true;
    }


}



/**
 * Gets or sets the period ID.
 * @member {String} period_id
 */
OHLCVTimeseriesPeriod.prototype['period_id'] = undefined;

/**
 * Gets or sets the length of the period in seconds.
 * @member {Number} length_seconds
 */
OHLCVTimeseriesPeriod.prototype['length_seconds'] = undefined;

/**
 * Gets or sets the length of the period in months.
 * @member {Number} length_months
 */
OHLCVTimeseriesPeriod.prototype['length_months'] = undefined;

/**
 * Gets or sets the unit count.
 * @member {Number} unit_count
 */
OHLCVTimeseriesPeriod.prototype['unit_count'] = undefined;

/**
 * Gets or sets the unit name.
 * @member {String} unit_name
 */
OHLCVTimeseriesPeriod.prototype['unit_name'] = undefined;

/**
 * Gets or sets the display name of the timeseries period.
 * @member {String} display_name
 */
OHLCVTimeseriesPeriod.prototype['display_name'] = undefined;






export default OHLCVTimeseriesPeriod;

