define('application/models/production/series', [
'antie/class'
], function (
Abstract
) {
'use strict';
return Abstract.extend({
/**
* Initialises the series model.
*
* @param {Object} data - The data.
*/
init: function (data) {
this._items = [];
this.addItem(data);
this._title = data.getTitle();
this._id = data.getSeriesId();
this._parentalWhitelisted = false;
},
/**
* Adds an item to the series display.
*
* @param {Object} item - The item.
*/
addItem: function (item) {
this._items.push(item);
},
/**
* Returns the item count.
*
* @returns {number} - The item count.
*/
getItemCount: function () {
return this._formattedItems.length;
},
/**
* The series title.
*
* @returns {string} - The title.
*/
getTitle: function () {
return this._title;
},
/**
* Returns the id.
*
* @returns {number} - The series id.
*/
getId: function () {
return this._id;
},
/**
* Returns the channel logo.
*
* @returns {string} - The channel logo.
*/
getChannelLogo: function () {
return this._formattedItems[0].getChannelLogo();
},
/**
* Returns the image url.
*
* @param {string} size - The image size.
* @returns {string} - The image url.
*/
getImageUrl: function (size) {
return this._formattedItems[0].getImageUrl(size);
},
/**
* Returns all the items.
*
* @returns {Array} - The items.
*/
getAllItems: function () {
return this._items;
},
/**
* Returns the formatted items.
*
* @returns {Array} - The items.
*/
getItems: function () {
return this._formattedItems;
},
/**
* Sets the formatted items on the series instance.
*
* @param {Array} items - The items.
*/
setFormattedItems: function (items) {
this._formattedItems = items;
},
/**
* Returns the channel id.
*
* @returns {number} - The channel id.
*/
getChannelId: function () {
return this._formattedItems[0].getChannelId();
},
/**
* Returns the series id.
*
* @returns {number} - The series id.
*/
getSeriesId: function () {
return this._formattedItems[0].getSeriesId();
},
/**
* Returns parental control level.
*
* @returns {*|number} - Parental control level.
*/
getPCLevel: function () {
return this._formattedItems[0].getPCLevel();
},
/**
* Returns parental genres.
*
* @returns {Array} - Parental genres.
*/
getParentalGenres: function () {
return this._formattedItems[0].getParentalGenres();
},
/**
* Sets program to be parental whitelisted.
*/
setParentalWhitelisted: function () {
this._parentalWhitelisted = true;
},
/**
* Gets if program is whitelisted.
*
* @returns {boolean} - If is whitelisted.
*/
getParentalWhitelisted: function () {
return this._parentalWhitelisted;
},
/**
* Returns the content type.
*
* @returns {string} - The content type.
*/
getContentType: function () {
return this._formattedItems[0].getContentType();
}
});
});