/**
* 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 { UserGroup } from './UserGroup.js';
/**
* The GroupMessage model module.
* @module model/GroupMessage
* @version v0
*/
export class GroupMessage {
/**
* Constructs a new <code>GroupMessage</code>.
* @alias GroupMessage
*/
constructor() {
GroupMessage.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>GroupMessage</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 {GroupMessage} obj Optional instance to populate.
* @return {GroupMessage} The populated <code>GroupMessage</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new GroupMessage();
if (data.hasOwnProperty('id')) {
obj['id'] = ApiClient.convertToType(data['id'], 'Number');
}
if (data.hasOwnProperty('from')) {
obj['from'] = Client.constructFromObject(data['from']);
}
if (data.hasOwnProperty('group')) {
obj['group'] = UserGroup.constructFromObject(data['group']);
}
if (data.hasOwnProperty('content')) {
obj['content'] = ApiClient.convertToType(data['content'], 'String');
}
if (data.hasOwnProperty('timestamp')) {
obj['timestamp'] = ApiClient.convertToType(data['timestamp'], 'Date');
}
}
return obj;
}
/**
* Validates the JSON data with respect to <code>GroupMessage</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>GroupMessage</code>.
*/
static validateJSON(data) {
// validate the optional field `from`
if (data['from']) { // data not null
Client.validateJSON(data['from']);
}
// validate the optional field `group`
if (data['group']) { // data not null
UserGroup.validateJSON(data['group']);
}
// ensure the json data is a string
if (data['content'] && !(typeof data['content'] === 'string' || data['content'] instanceof String)) {
throw new Error("Expected the field `content` to be a primitive type in the JSON string but got " + data['content']);
}
return true;
}
}
/**
* @member {Number} id
*/
GroupMessage.prototype['id'] = undefined;
/**
* @member {Client} from
*/
GroupMessage.prototype['from'] = undefined;
/**
* @member {UserGroup} group
*/
GroupMessage.prototype['group'] = undefined;
/**
* @member {String} content
*/
GroupMessage.prototype['content'] = undefined;
/**
* @member {Date} timestamp
*/
GroupMessage.prototype['timestamp'] = undefined;
export default GroupMessage;