'use strict';

var EventFactory = angular.module('events.factory', [
]).factory('EventFactory', [
    'Common',
    function(Common) {

        function Event(data) {
            var self = this;
            if (data) angular.extend(this, data);           
            this.PublishedOn = new Date(this.PublishedOn);

            this.NameAndCity = function () {
                return " Andrej@" + self.Title;
            };

            this.TaxTotal = function () {
            };

            this.IsAllDayEvent = function () {
                if (self.AllDayEvent === true)
                    return "Da";
                else {
                    return "Ne";
                }
            };
        }
        
        var create = function(data) {
            return new Event(data);
        };

        return {
            create: create
        };
    }
]);