(function() {
    BemsWebApplication.BemsFormulaViewModel = function(data) {
            this.SiteId = ko.observable();
            this.FacilityTypeId = ko.observable();
            this.FacilityCode = ko.observable();
            this.FormulaId = ko.observable();
            this.Formula = ko.observable();
            if(data)
                this.fromJS(data);
    };

    $.extend(BemsWebApplication.BemsFormulaViewModel.prototype, {
        toJS: function() {
            return {
                SiteId: this.SiteId(),
                FacilityTypeId: this.FacilityTypeId(),
                FacilityCode: this.FacilityCode(),
                FormulaId: this.FormulaId(),
                Formula: this.Formula(),
            };
        },

        fromJS: function(data) {
            if(data) {
                this.SiteId(data.SiteId);
                this.FacilityTypeId(data.FacilityTypeId);
                this.FacilityCode(data.FacilityCode);
                this.FormulaId(data.FormulaId);
                this.Formula(data.Formula);

            }
        }
    });
})();