/**
* GameBrain API
* GameBrain API
*
* The version of the OpenAPI document: 1.0.1
* Contact: mail@gamebrain.co
*
* 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';
import SearchResponseResultsInnerRating from './SearchResponseResultsInnerRating';
/**
* The SearchResponseResultsInner model module.
* @module model/SearchResponseResultsInner
* @version 1.0.2
*/
class SearchResponseResultsInner {
/**
* Constructs a new <code>SearchResponseResultsInner</code>.
* @alias module:model/SearchResponseResultsInner
*/
constructor() {
SearchResponseResultsInner.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>SearchResponseResultsInner</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 {module:model/SearchResponseResultsInner} obj Optional instance to populate.
* @return {module:model/SearchResponseResultsInner} The populated <code>SearchResponseResultsInner</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new SearchResponseResultsInner();
if (data.hasOwnProperty('id')) {
obj['id'] = ApiClient.convertToType(data['id'], 'Number');
}
if (data.hasOwnProperty('year')) {
obj['year'] = ApiClient.convertToType(data['year'], 'Number');
}
if (data.hasOwnProperty('name')) {
obj['name'] = ApiClient.convertToType(data['name'], 'String');
}
if (data.hasOwnProperty('genre')) {
obj['genre'] = ApiClient.convertToType(data['genre'], 'String');
}
if (data.hasOwnProperty('image')) {
obj['image'] = ApiClient.convertToType(data['image'], 'String');
}
if (data.hasOwnProperty('link')) {
obj['link'] = ApiClient.convertToType(data['link'], 'String');
}
if (data.hasOwnProperty('rating')) {
obj['rating'] = SearchResponseResultsInnerRating.constructFromObject(data['rating']);
}
if (data.hasOwnProperty('adult_only')) {
obj['adult_only'] = ApiClient.convertToType(data['adult_only'], 'Boolean');
}
if (data.hasOwnProperty('screenshots')) {
obj['screenshots'] = ApiClient.convertToType(data['screenshots'], ['String']);
}
if (data.hasOwnProperty('micro_trailer')) {
obj['micro_trailer'] = ApiClient.convertToType(data['micro_trailer'], 'String');
}
if (data.hasOwnProperty('gameplay')) {
obj['gameplay'] = ApiClient.convertToType(data['gameplay'], 'String');
}
if (data.hasOwnProperty('short_description')) {
obj['short_description'] = ApiClient.convertToType(data['short_description'], 'String');
}
}
return obj;
}
/**
* Validates the JSON data with respect to <code>SearchResponseResultsInner</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>SearchResponseResultsInner</code>.
*/
static validateJSON(data) {
// 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']);
}
// ensure the json data is a string
if (data['genre'] && !(typeof data['genre'] === 'string' || data['genre'] instanceof String)) {
throw new Error("Expected the field `genre` to be a primitive type in the JSON string but got " + data['genre']);
}
// ensure the json data is a string
if (data['image'] && !(typeof data['image'] === 'string' || data['image'] instanceof String)) {
throw new Error("Expected the field `image` to be a primitive type in the JSON string but got " + data['image']);
}
// ensure the json data is a string
if (data['link'] && !(typeof data['link'] === 'string' || data['link'] instanceof String)) {
throw new Error("Expected the field `link` to be a primitive type in the JSON string but got " + data['link']);
}
// validate the optional field `rating`
if (data['rating']) { // data not null
SearchResponseResultsInnerRating.validateJSON(data['rating']);
}
// ensure the json data is an array
if (!Array.isArray(data['screenshots'])) {
throw new Error("Expected the field `screenshots` to be an array in the JSON data but got " + data['screenshots']);
}
// ensure the json data is a string
if (data['micro_trailer'] && !(typeof data['micro_trailer'] === 'string' || data['micro_trailer'] instanceof String)) {
throw new Error("Expected the field `micro_trailer` to be a primitive type in the JSON string but got " + data['micro_trailer']);
}
// ensure the json data is a string
if (data['gameplay'] && !(typeof data['gameplay'] === 'string' || data['gameplay'] instanceof String)) {
throw new Error("Expected the field `gameplay` to be a primitive type in the JSON string but got " + data['gameplay']);
}
// ensure the json data is a string
if (data['short_description'] && !(typeof data['short_description'] === 'string' || data['short_description'] instanceof String)) {
throw new Error("Expected the field `short_description` to be a primitive type in the JSON string but got " + data['short_description']);
}
return true;
}
}
/**
* @member {Number} id
*/
SearchResponseResultsInner.prototype['id'] = undefined;
/**
* @member {Number} year
*/
SearchResponseResultsInner.prototype['year'] = undefined;
/**
* @member {String} name
*/
SearchResponseResultsInner.prototype['name'] = undefined;
/**
* @member {String} genre
*/
SearchResponseResultsInner.prototype['genre'] = undefined;
/**
* @member {String} image
*/
SearchResponseResultsInner.prototype['image'] = undefined;
/**
* @member {String} link
*/
SearchResponseResultsInner.prototype['link'] = undefined;
/**
* @member {module:model/SearchResponseResultsInnerRating} rating
*/
SearchResponseResultsInner.prototype['rating'] = undefined;
/**
* @member {Boolean} adult_only
*/
SearchResponseResultsInner.prototype['adult_only'] = undefined;
/**
* @member {Array.<String>} screenshots
*/
SearchResponseResultsInner.prototype['screenshots'] = undefined;
/**
* @member {String} micro_trailer
*/
SearchResponseResultsInner.prototype['micro_trailer'] = undefined;
/**
* @member {String} gameplay
*/
SearchResponseResultsInner.prototype['gameplay'] = undefined;
/**
* @member {String} short_description
*/
SearchResponseResultsInner.prototype['short_description'] = undefined;
export default SearchResponseResultsInner;