Source: client/openapi/model/Welcome.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 { Client } from './Client.js';
import { VRObject } from './VRObject.js';

/**
 * The Welcome model module.
 * @module model/Welcome
 * @version v0
 */
export class Welcome {
    /**
     * Constructs a new <code>Welcome</code>.
     * Welcome message is first one sent once the client enters a world. Contains  current Client object, used by the client to identify itself. Optionally it  also contains list of permanent objects.
     * @alias Welcome
     */
    constructor() { 
        
        
        /** client 
         * @type {Client} 
         */
        this.client = undefined;

        /** permanents 
         * @type {Array.<VRObject>} 
         */
        this.permanents = undefined;

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

            if (data.hasOwnProperty('client')) {
                obj['client'] = Client.constructFromObject(data['client']);
            }
            if (data.hasOwnProperty('permanents')) {
                obj['permanents'] = ApiClient.convertToType(data['permanents'], [VRObject]);
            }
            if (data.hasOwnProperty('timestamp')) {
                obj['timestamp'] = ApiClient.convertToType(data['timestamp'], 'Date');
            }
        }
        return obj;
    }

    /**
     * Validates the JSON data with respect to <code>Welcome</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>Welcome</code>.
     */
    static validateJSON(data) {
        // validate the optional field `client`
        if (data['client']) { // data not null
          Client.validateJSON(data['client']);
        }
        if (data['permanents']) { // data not null
            // ensure the json data is an array
            if (!Array.isArray(data['permanents'])) {
                throw new Error("Expected the field `permanents` to be an array in the JSON data but got " + data['permanents']);
            }
            // validate the optional field `permanents` (array)
            for (const item of data['permanents']) {
                VRObject.validateJSON(item);
            };
        }

        return true;
    }


}





export default Welcome;