Source: client/openapi/model/User.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 { Animation } from './Animation.js';
import { Point } from './Point.js';
import { Quaternion } from './Quaternion.js';
import { Rotation } from './Rotation.js';
import { SceneProperties } from './SceneProperties.js';
import { VRObject } from './VRObject.js';

/**
 * The User model module.
 * @module model/User
 * @version v0
 */
export class User {
    /**
     * Constructs a new <code>User</code>.
     * @alias User
     */
    constructor() { 
        
        User.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>User</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 {User} obj Optional instance to populate.
     * @return {User} The populated <code>User</code> instance.
     */
    static constructFromObject(data, obj) {
        if (data) {
            obj = obj || new User();

            if (data.hasOwnProperty('id')) {
                obj['id'] = ApiClient.convertToType(data['id'], 'Number');
            }
            if (data.hasOwnProperty('children')) {
                obj['children'] = ApiClient.convertToType(data['children'], [VRObject]);
            }
            if (data.hasOwnProperty('position')) {
                obj['position'] = Point.constructFromObject(data['position']);
            }
            if (data.hasOwnProperty('rotation')) {
                obj['rotation'] = Rotation.constructFromObject(data['rotation']);
            }
            if (data.hasOwnProperty('scale')) {
                obj['scale'] = Point.constructFromObject(data['scale']);
            }
            if (data.hasOwnProperty('permanent')) {
                obj['permanent'] = ApiClient.convertToType(data['permanent'], 'Boolean');
            }
            if (data.hasOwnProperty('active')) {
                obj['active'] = ApiClient.convertToType(data['active'], 'Boolean');
            }
            if (data.hasOwnProperty('mesh')) {
                obj['mesh'] = ApiClient.convertToType(data['mesh'], 'String');
            }
            if (data.hasOwnProperty('script')) {
                obj['script'] = ApiClient.convertToType(data['script'], 'String');
            }
            if (data.hasOwnProperty('animation')) {
                obj['animation'] = Animation.constructFromObject(data['animation']);
            }
            if (data.hasOwnProperty('name')) {
                obj['name'] = ApiClient.convertToType(data['name'], 'String');
            }
            if (data.hasOwnProperty('humanoid')) {
                obj['humanoid'] = ApiClient.convertToType(data['humanoid'], 'Boolean');
            }
            if (data.hasOwnProperty('video')) {
                obj['video'] = ApiClient.convertToType(data['video'], 'Boolean');
            }
            if (data.hasOwnProperty('rightArmPos')) {
                obj['rightArmPos'] = Point.constructFromObject(data['rightArmPos']);
            }
            if (data.hasOwnProperty('leftArmRot')) {
                obj['leftArmRot'] = Quaternion.constructFromObject(data['leftArmRot']);
            }
            if (data.hasOwnProperty('leftArmPos')) {
                obj['leftArmPos'] = Point.constructFromObject(data['leftArmPos']);
            }
            if (data.hasOwnProperty('rightArmRot')) {
                obj['rightArmRot'] = Quaternion.constructFromObject(data['rightArmRot']);
            }
            if (data.hasOwnProperty('sceneProperties')) {
                obj['sceneProperties'] = SceneProperties.constructFromObject(data['sceneProperties']);
            }
            if (data.hasOwnProperty('userHeight')) {
                obj['userHeight'] = ApiClient.convertToType(data['userHeight'], 'Number');
            }
            if (data.hasOwnProperty('tokens')) {
                obj['tokens'] = ApiClient.convertToType(data['tokens'], {'String': 'String'});
            }
            if (data.hasOwnProperty('temporary')) {
                obj['temporary'] = ApiClient.convertToType(data['temporary'], 'Boolean');
            }
            if (data.hasOwnProperty('properties')) {
                obj['properties'] = ApiClient.convertToType(data['properties'], {'String': Object});
            }
        }
        return obj;
    }

    /**
     * Validates the JSON data with respect to <code>User</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>User</code>.
     */
    static validateJSON(data) {
        if (data['children']) { // data not null
            // ensure the json data is an array
            if (!Array.isArray(data['children'])) {
                throw new Error("Expected the field `children` to be an array in the JSON data but got " + data['children']);
            }
            // validate the optional field `children` (array)
            for (const item of data['children']) {
                VRObject.validateJSON(item);
            };
        }
        // validate the optional field `position`
        if (data['position']) { // data not null
          Point.validateJSON(data['position']);
        }
        // validate the optional field `rotation`
        if (data['rotation']) { // data not null
          Rotation.validateJSON(data['rotation']);
        }
        // validate the optional field `scale`
        if (data['scale']) { // data not null
          Point.validateJSON(data['scale']);
        }
        // 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']);
        }
        // ensure the json data is a string
        if (data['script'] && !(typeof data['script'] === 'string' || data['script'] instanceof String)) {
            throw new Error("Expected the field `script` to be a primitive type in the JSON string but got " + data['script']);
        }
        // validate the optional field `animation`
        if (data['animation']) { // data not null
          Animation.validateJSON(data['animation']);
        }
        // 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']);
        }
        // validate the optional field `rightArmPos`
        if (data['rightArmPos']) { // data not null
          Point.validateJSON(data['rightArmPos']);
        }
        // validate the optional field `leftArmRot`
        if (data['leftArmRot']) { // data not null
          Quaternion.validateJSON(data['leftArmRot']);
        }
        // validate the optional field `leftArmPos`
        if (data['leftArmPos']) { // data not null
          Point.validateJSON(data['leftArmPos']);
        }
        // validate the optional field `rightArmRot`
        if (data['rightArmRot']) { // data not null
          Quaternion.validateJSON(data['rightArmRot']);
        }
        // validate the optional field `sceneProperties`
        if (data['sceneProperties']) { // data not null
          SceneProperties.validateJSON(data['sceneProperties']);
        }

        return true;
    }


}



/**
 * @member {Number} id
 */
User.prototype['id'] = undefined;

/**
 * @member {Array.<VRObject>} children
 */
User.prototype['children'] = undefined;

/**
 * @member {Point} position
 */
User.prototype['position'] = undefined;

/**
 * @member {Rotation} rotation
 */
User.prototype['rotation'] = undefined;

/**
 * @member {Point} scale
 */
User.prototype['scale'] = undefined;

/**
 * Permanent objects are always present (e.g. sky)
 * @member {Boolean} permanent
 */
User.prototype['permanent'] = undefined;

/**
 * Whether an object is active (can send events). E.g. online users, robots.
 * @member {Boolean} active
 */
User.prototype['active'] = undefined;

/**
 * URL of the file containing the mesh.
 * @member {String} mesh
 */
User.prototype['mesh'] = undefined;

/**
 * Script that client runs. To prevent cross-site scripting, this is a read-only  property.
 * @member {String} script
 */
User.prototype['script'] = undefined;

/**
 * @member {Animation} animation
 */
User.prototype['animation'] = undefined;

/**
 * Client name - unique ID.
 * @member {String} name
 */
User.prototype['name'] = undefined;

/**
 * Does this client have humanoid avatar, default true
 * @member {Boolean} humanoid
 */
User.prototype['humanoid'] = undefined;

/**
 * Does this client have video avatar, default false
 * @member {Boolean} video
 */
User.prototype['video'] = undefined;

/**
 * @member {Point} rightArmPos
 */
User.prototype['rightArmPos'] = undefined;

/**
 * @member {Quaternion} leftArmRot
 */
User.prototype['leftArmRot'] = undefined;

/**
 * @member {Point} leftArmPos
 */
User.prototype['leftArmPos'] = undefined;

/**
 * @member {Quaternion} rightArmRot
 */
User.prototype['rightArmRot'] = undefined;

/**
 * @member {SceneProperties} sceneProperties
 */
User.prototype['sceneProperties'] = undefined;

/**
 * User's height in real life, used in VR. Transient biometric data.
 * @member {Number} userHeight
 */
User.prototype['userHeight'] = undefined;

/**
 * Tokens used to access video/audio streaming servers, identify conversations  with chatbots etc. Transient, never stored to the database.
 * @member {Object.<String, String>} tokens
 */
User.prototype['tokens'] = undefined;

/**
 * Temporary objects will be deleted from the database along with their owner
 * @member {Boolean} temporary
 */
User.prototype['temporary'] = undefined;

/**
 * Custom transient object properties
 * @member {Object.<String, Object>} properties
 */
User.prototype['properties'] = undefined;






export default User;