/**
 * (c) by aheadware.com
 */
"use strict";

var app = app || {};
app.model = app.model || {};

/**
 * Notification Model
 */
app.model.Notification = function( data )
{
    var id = data.id,
        creator_profile_id = data.creator_profile_id || null,
        creatorName = data.creator_name || null,
        mCreated = app.util.Helper.getMomentFromUTCTime( data.created_dt ),
        mLastUpdated = app.util.Helper.getMomentFromUTCTime( data.last_updated_dt ),
        receiverProfileId = data.receiver_profile_id,
        headline = data.headline || null,
        message = data.message || null,
        isRead = data.is_read || 0,
        additionalData = data.additional_data_js || null;

    this.getCreatorName = function()
    {
        if ( null === creator_profile_id )
        {
            return '<strong>Pro</strong>Buddy';
        }
        else
        {
            return creatorName;
        }
    };

    /**
     *
     * @returns {String}
     */
    this.getMessage = function()
    {
        return message;
    };

    this.getHeadline = function()
    {
        return headline;
    };

    this.getId = function()
    {
        return id;
    };

    this.getMomentCreated = function()
    {
        return mCreated;
    };

    this.getReceiverProfileId = function()
    {
        return receiverProfileId;
    };

    this.getAdditionalData = function()
    {
        return additionalData;
    };

    this.getActionUrl = function()
    {
        if ( additionalData && additionalData.hasOwnProperty( 'inAppUrl' ) )
        {
            return additionalData.inAppUrl;
        }
        else
        {
            return null;
        }
    };

    this.isForceReload = function()
    {
        if ( additionalData && additionalData.hasOwnProperty( 'forceReload' ) && true === additionalData.forceReload  )
        {
            return true;
        }
        else
        {
            return false;
        }
    };

    this.isUnread = function()
    {
        return ( 0 == isRead );
    };

};