/**
* 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 { Rotation } from './Rotation.js';
/**
* The VRObject model module.
* @module model/VRObject
* @version v0
*/
export class VRObject {
/**
* Constructs a new <code>VRObject</code>.
* Basic VR Object encapsulates minimal spatial and other properties.
* @alias VRObject
*/
constructor() {
/** id
* @type {Number}
*/
this.id = 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;
/** 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;
VRObject.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>VRObject</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 {VRObject} obj Optional instance to populate.
* @return {VRObject} The populated <code>VRObject</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new VRObject();
if (data.hasOwnProperty('id')) {
obj['id'] = ApiClient.convertToType(data['id'], 'Number');
}
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('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>VRObject</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>VRObject</code>.
*/
static validateJSON(data) {
// 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']);
}
return true;
}
}
export default VRObject;