Source: client/openapi/model/SearchAgentResponse.js

/**
 * OpenAPI definition
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v0
 * 
 *
 * 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.js';
import { GltfModel } from './GltfModel.js';

/**
 * The SearchAgentResponse model module.
 * @module model/SearchAgentResponse
 * @version v0
 */
export class SearchAgentResponse {
    /**
     * Constructs a new <code>SearchAgentResponse</code>.
     * @alias SearchAgentResponse
     */
    constructor() { 
        
        
        /** answer 
         * @type {String} 
         */
        this.answer = undefined;

        /** size 
         * @type {Number} 
         */
        this.size = undefined;

        /** models 
         * @type {Array.<GltfModel>} 
         */
        this.models = undefined;

        /** success 
         * @type {Boolean} 
         */
        this.success = undefined;
        
        
        
        
        SearchAgentResponse.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>SearchAgentResponse</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 {SearchAgentResponse} obj Optional instance to populate.
     * @return {SearchAgentResponse} The populated <code>SearchAgentResponse</code> instance.
     */
    static constructFromObject(data, obj) {
        if (data) {
            obj = obj || new SearchAgentResponse();

            if (data.hasOwnProperty('answer')) {
                obj['answer'] = ApiClient.convertToType(data['answer'], 'String');
            }
            if (data.hasOwnProperty('size')) {
                obj['size'] = ApiClient.convertToType(data['size'], 'Number');
            }
            if (data.hasOwnProperty('models')) {
                obj['models'] = ApiClient.convertToType(data['models'], [GltfModel]);
            }
            if (data.hasOwnProperty('success')) {
                obj['success'] = ApiClient.convertToType(data['success'], 'Boolean');
            }
        }
        return obj;
    }

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

        return true;
    }


}





export default SearchAgentResponse;