/**
* 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() {
/** id
* @type {Number}
*/
this.id = undefined;
/** children
* @type {Array.<VRObject>}
*/
this.children = undefined;
/** position
* @type {Point}
*/
this.position = undefined;
/** rotation
* @type {Rotation}
*/
this.rotation = undefined;
/** scale
* @type {Point}
*/
this.scale = undefined;
/** permanent
* Permanent objects are always present (e.g. sky)
* @type {Boolean}
*/
this.permanent = undefined;
/** active
* Whether an object is active (can send events). E.g. online users, robots.
* @type {Boolean}
*/
this.active = undefined;
/** mesh
* URL of the file containing the mesh.
* @type {String}
*/
this.mesh = undefined;
/** script
* Script that client runs. To prevent cross-site scripting, this is a read-only property.
* @type {String}
*/
this.script = undefined;
/** animation
* @type {Animation}
*/
this.animation = undefined;
/** name
* Client name - unique ID.
* @type {String}
*/
this.name = undefined;
/** humanoid
* Does this client have humanoid avatar, default true
* @type {Boolean}
*/
this.humanoid = undefined;
/** video
* Does this client have video avatar, default false
* @type {Boolean}
*/
this.video = undefined;
/** rightArmPos
* @type {Point}
*/
this.rightArmPos = undefined;
/** leftArmRot
* @type {Quaternion}
*/
this.leftArmRot = undefined;
/** leftArmPos
* @type {Point}
*/
this.leftArmPos = undefined;
/** rightArmRot
* @type {Quaternion}
*/
this.rightArmRot = undefined;
/** sceneProperties
* @type {SceneProperties}
*/
this.sceneProperties = undefined;
/** userHeight
* User's height in real life, used in VR. Transient biometric data.
* @type {Number}
*/
this.userHeight = undefined;
/** tokens
* Tokens used to access video/audio streaming servers, identify conversations with chatbots etc. Transient, never stored to the database.
* @type {Object.<String, String>}
*/
this.tokens = undefined;
/** temporary
* Temporary objects will be deleted from the database along with their owner
* @type {Boolean}
*/
this.temporary = undefined;
/** properties
* Custom transient object properties
* @type {Object.<String, Object>}
*/
this.properties = undefined;
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;
}
}
export default User;