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

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

/**
 * Chat Model
 */
app.model.Chat = function( data )
{
    var id = data.id,
        creatorId = data.creator_profile_id || null,
        creatorFirstName = data.first_name || null,
        creatorLastName = data.last_name || null,
        creatorPicUrl = data.pic_url || null,
        refId = data.ref_id || null,
        message = data.message || null,
        mCreated = app.util.Helper.getMomentFromUTCTime(data.created_dt),
        mLastUpdated = app.util.Helper.getMomentFromUTCTime(data.last_updated_dt);

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

    this.getCreatorName = function()
    {
        var name = '<strong>Pro</strong>Buddy';

        if ( creatorId != null && 0 < creatorId )
        {
            if ( creatorFirstName && creatorFirstName.length )
            {
                name = creatorFirstName;
                if ( creatorLastName && creatorLastName.length )
                {
                    name = name + " " + creatorLastName;
                }
            }
            else if ( creatorLastName && creatorLastName.lengt )
            {
                name = creatorLastName;
            }
        }

        return name;
    };

    this.getCreatorPicUrl = function()
    {
        return creatorPicUrl ? creatorPicUrl : './img-system/user-icon-default.png';
    };

    this.getMessage = function()
    {
        return message;
    };

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