(function () {
    BemsWebApplication.BemsEnergyDailyViewModel = function (data) {
        this.SiteId = ko.observable();
        this.BuildingId = ko.observable();
        this.ServiceTypeId = ko.observable();
        this.FuelTypeId = ko.observable();
        this.CreatedDate = ko.observable();
        this.Prediction = ko.observable();
        this.Measurement = ko.observable();
        this.Goal = ko.observable();
        this.Prediction_Regression = ko.observable();
        this.MeanT = ko.observable();
        this.HDD = ko.observable();
        this.CDD = ko.observable();
        if (data)
            this.fromJS(data);
    };

    $.extend(BemsWebApplication.BemsEnergyDailyViewModel.prototype, {
        toJS: function () {
            return {
                SiteId: this.SiteId(),
                BuildingId: this.BuildingId(),
                ServiceTypeId: this.ServiceTypeId(),
                FuelTypeId: this.FuelTypeId(),
                CreatedDate: this.CreatedDate(),
                Prediction: this.Prediction(),
                Measurement: this.Measurement(),
                Goal: this.Goal(),
                Prediction_Regression: this.Prediction_Regression(),
                MeanT: this.MeanT(),
                HDD: this.HDD(),
                CDD: this.CDD(),
            };
        },

        fromJS: function (data) {
            if (data) {
                this.SiteId(data.SiteId);
                this.BuildingId(data.BuildingId);
                this.ServiceTypeId(data.ServiceTypeId);
                this.FuelTypeId(data.FuelTypeId);
                this.CreatedDate(data.CreatedDate);
                this.Prediction(data.Prediction);
                this.Measurement(data.Measurement);
                this.Goal(data.Goal);
                this.Prediction_Regression(data.Prediction_Regression);
                this.MeanT(data.MeanT);
                this.HDD(data.HDD);
                this.CDD(data.CDD);
            }
        }
    });
})();