Source: client/openapi/model/GltfModel.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 { ContentCategory } from './ContentCategory.js';

/**
 * The GltfModel model module.
 * @module model/GltfModel
 * @version v0
 */
export class GltfModel {
    /**
     * Constructs a new <code>GltfModel</code>.
     * A 3D Model in GLTF format. Adds unique id, uri and other properties to  Content class. Based on sketchfab models.
     * @alias GltfModel
     */
    constructor() { 
        
        GltfModel.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>GltfModel</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 {GltfModel} obj Optional instance to populate.
     * @return {GltfModel} The populated <code>GltfModel</code> instance.
     */
    static constructFromObject(data, obj) {
        if (data) {
            obj = obj || new GltfModel();

            if (data.hasOwnProperty('fileName')) {
                obj['fileName'] = ApiClient.convertToType(data['fileName'], 'String');
            }
            if (data.hasOwnProperty('contentType')) {
                obj['contentType'] = ApiClient.convertToType(data['contentType'], 'String');
            }
            if (data.hasOwnProperty('length')) {
                obj['length'] = ApiClient.convertToType(data['length'], 'Number');
            }
            if (data.hasOwnProperty('uid')) {
                obj['uid'] = ApiClient.convertToType(data['uid'], 'String');
            }
            if (data.hasOwnProperty('uri')) {
                obj['uri'] = ApiClient.convertToType(data['uri'], 'String');
            }
            if (data.hasOwnProperty('name')) {
                obj['name'] = ApiClient.convertToType(data['name'], 'String');
            }
            if (data.hasOwnProperty('description')) {
                obj['description'] = ApiClient.convertToType(data['description'], 'String');
            }
            if (data.hasOwnProperty('license')) {
                obj['license'] = ApiClient.convertToType(data['license'], 'String');
            }
            if (data.hasOwnProperty('author')) {
                obj['author'] = ApiClient.convertToType(data['author'], 'String');
            }
            if (data.hasOwnProperty('categories')) {
                obj['categories'] = ApiClient.convertToType(data['categories'], [ContentCategory]);
            }
            if (data.hasOwnProperty('mesh')) {
                obj['mesh'] = ApiClient.convertToType(data['mesh'], 'String');
            }
        }
        return obj;
    }

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

        return true;
    }


}



/**
 * @member {String} fileName
 */
GltfModel.prototype['fileName'] = undefined;

/**
 * @member {String} contentType
 */
GltfModel.prototype['contentType'] = undefined;

/**
 * @member {Number} length
 */
GltfModel.prototype['length'] = undefined;

/**
 * @member {String} uid
 */
GltfModel.prototype['uid'] = undefined;

/**
 * @member {String} uri
 */
GltfModel.prototype['uri'] = undefined;

/**
 * @member {String} name
 */
GltfModel.prototype['name'] = undefined;

/**
 * @member {String} description
 */
GltfModel.prototype['description'] = undefined;

/**
 * @member {String} license
 */
GltfModel.prototype['license'] = undefined;

/**
 * @member {String} author
 */
GltfModel.prototype['author'] = undefined;

/**
 * @member {Array.<ContentCategory>} categories
 */
GltfModel.prototype['categories'] = undefined;

/**
 * @member {String} mesh
 */
GltfModel.prototype['mesh'] = undefined;






export default GltfModel;