Source: models/production/recordings/record.js

define('application/models/production/recordings/record', [
    'application/models/broadcast'
], function (
    Abstract
) {
    'use strict';

    return Abstract.extend({

        /**
         * Initialises the model.
         *
         * @param {Object} data - The data.
         */
        init: function init (data) {
            var metadata = data.metadata;

            init.base.call(this, data);

            this._id = metadata.liveContentId;
            this._contentType = metadata.contentType;
            this._contentSubtype = metadata.contentSubtype;
            this._startTime = (metadata.programStartTime / 1000);
            this._endTime = (metadata.programStartTime / 1000) + metadata.programDuration;
            this._duration = metadata.programDuration || metadata.duration;
            this._recordingId = metadata.contentId;
            this._startDeltaTime = metadata.startDeltaTime;
            this._stopDeltaTime = metadata.stopDeltaTime;
            this._assets = data.assets;
        },

        /**
         * Returns the content type.
         *
         * @returns {string} - The content type.
         */
        getContentType: function () {
            return this._contentType;
        },

        /**
         * Returns the content subtype.
         *
         * @returns {string} - The content subtype.
         */
        getContentSubtype: function () {
            return this._contentSubtype;
        },

        /**
         * Returns true if the item can be played.
         *
         * @returns {boolean} - True if the item can be played.
         */
        canCatchup: function () {
            return this._assets.length > 0;
        },

        /**
         * Returns the start delta time.
         *
         * @returns {number} - The start delta time.
         */
        getStartDeltaTime: function () {
            return this._startDeltaTime;
        },

        /**
         * Returns the stop delta time.
         *
         * @returns {number} - The stop delta time.
         */
        getStopDeltaTime: function () {
            return this._endDeltaTime;
        },

        /**
         * Returns the recording id.
         *
         * @returns {number} - The recording id.
         */
        getRecordingId: function () {
            return this._recordingId;
        }
    });
});