(function() {
    BemsWebApplication.FmsFacilityCodeClassViewModel = function(data) {
            this.SiteId = ko.observable();
            this.FacilityClassId = ko.observable();
            this.ParentFacilityClassId = ko.observable();
            this.Depth = ko.observable();
            this.Name = ko.observable();
            this.Abbreviation = ko.observable();
            this.IsUse = ko.observable();
            if(data)
                this.fromJS(data);
    };

    $.extend(BemsWebApplication.FmsFacilityCodeClassViewModel.prototype, {
        toJS: function() {
            return {
                SiteId: this.SiteId(),
                FacilityClassId: this.FacilityClassId(),
                ParentFacilityClassId: this.ParentFacilityClassId(),
                Depth: this.Depth(),
                Name: this.Name(),
                Abbreviation: this.Abbreviation(),
                IsUse: this.IsUse(),
            };
        },

        fromJS: function(data) {
            if(data) {
                this.SiteId(data.SiteId);
                this.FacilityClassId(data.FacilityClassId);
                this.ParentFacilityClassId(data.ParentFacilityClassId);
                this.Depth(data.Depth);
                this.Name(data.Name);
                this.Abbreviation(data.Abbreviation);
                this.IsUse(data.IsUse);

            }
        }
    });
})();