define('application/models/production/streams/promo', [
'rofl/models/api/abstract',
'antie/runtimecontext'
], function (
Abstract,
RuntimeContext
) {
'use strict';
var application = RuntimeContext.getCurrentApplication(),
promoUrl = application.getConfiguration().videos.PROMO,
introUrl = application.getConfiguration().videos.INTRO;
return Abstract.extend({
/**
* This will create an URL to call on API.
*
* @param {Object} params - Parameters to determine the endpoint.
* @param {string} params.type - The type of promo video (promo or intro).
* @returns {string} - The endpoint.
*/
resolveEndpoint: function (params) { // eslint-disable-line no-unused-vars
return '';
},
/**
* Check whether we have to use local data for this API model.
*
* @param {Object} opts - Options object.
* @returns {boolean} Whether the model needs to use local data.
*/
hasLocalData: function (opts) { // eslint-disable-line no-unused-vars
return true;
},
/**
* Retrieves the local data if there is any.
*
* @param {Object} opts - Options object.
* @returns {*} Local response data.
*/
getLocalData: function (opts) { // eslint-disable-line no-unused-vars
return {
url: opts.type === 'promo' ? promoUrl : introUrl
};
}
});
});