Source: models/production/menu.js

define('application/models/production/menu', [
    'rofl/models/api/abstract',
    'rofl/lib/l10n',
    'application/managers/feature',
    'antie/runtimecontext'
], function (
    Abstract,
    L10N,
    FeatureManager,
    RuntimeContext
) {
    'use strict';

    var l10n = L10N.getInstance();

    return Abstract.extend({

        /**
         * Checks if model has local data.
         *
         * @returns {boolean} - True or false if local data exists or not.
         */
        hasLocalData: function () {
            return true;
        },

        /**
         * Return local data.
         *
         * @returns {Array} - Array of object with menu data.
         */
        getLocalData: function () {
            var menu = {
                middle: [
                    {
                        '_id': 6,
                        '_label': l10n.get('menu.search'),
                        '_icon': 'icon-search-v2',
                        'route': 'search',
                        args: {keepHistory: false}
                    },
                    {
                        '_id': 7,
                        '_label': l10n.get('menu.home'),
                        '_icon': 'icon-home',
                        'route': 'home',
                        args: {keepHistory: false}
                    },
                    {
                        '_id': 1,
                        '_label': l10n.get('menu.channellist'),
                        '_icon': 'icon-now-on-tv',
                        'route': 'channellist',
                        args: {keepHistory: false}
                    },
                    {
                        '_id': 2,
                        '_label': l10n.get('menu.guide'),
                        '_icon': 'icon-guide',
                        'route': 'guide',
                        args: {keepHistory: false}
                    }
                ]
            };

            if (FeatureManager.getInstance().isRecordingEnabled()
                && RuntimeContext.getCurrentApplication().getUser().canRecord()) {
                menu.middle.push({
                    '_id': 3,
                    '_label': l10n.get('menu.recordings'),
                    '_icon': 'icon-my-recordings',
                    'route': 'recordings',
                    args: {keepHistory: false}
                });
            }

            if (FeatureManager.getInstance().isMoviesEnabled()) {
                menu.middle.push({
                    '_id': 5,
                    '_label': l10n.get('menu.movies'),
                    '_icon': 'icon-movies',
                    'route': 'movies',
                    args: {keepHistory: false}
                });
            }

            if (FeatureManager.getInstance().isSeriesEnabled()) {
                menu.middle.push({
                    '_id': 6,
                    '_label': l10n.get('menu.series'),
                    '_icon': 'icon-series',
                    'route': 'series',
                    args: {keepHistory: false}
                });
            }

            if (FeatureManager.getInstance().isSportsEnabled()) {
                menu.middle.push({
                    '_id': 7,
                    '_label': l10n.get('menu.sports'),
                    '_icon': 'icon-sport',
                    'route': 'sports',
                    args: {keepHistory: false}
                });
            }

            menu.middle.push({
                '_id': 8,
                '_label': l10n.get('menu.settings'),
                '_icon': 'icon-settings',
                'route': 'settings',
                args: {keepHistory: false}
            },
            {
                '_id': 9,
                '_label': l10n.get('menu.exit'),
                '_icon': 'icon-remove',
                'route': 'exit',
                args: {keepHistory: false}
            });

            return menu;
        },

        /**
         * Transforms api data to application data.
         *
         * @param {Object} data - Data object.
         * @returns {Object} Application data.
         */
        transformFrom: function (data) {
            if (data.menu) {
                this.modelProperty = data.menu;
            }

            return this;
        }
    });
});