(function () {
    BemsWebApplication.FmsAccidentCodeTypeViewModel = function (data) {
        this.SiteId = ko.observable();
        this.AccidentTypeId = ko.observable();
        this.Name = ko.observable();
        this.IsUse = ko.observable();
        if (data)
            this.fromJS(data);
    };

    $.extend(BemsWebApplication.FmsAccidentCodeTypeViewModel.prototype, {
        toJS: function () {
            return {
                SiteId: this.SiteId(),
                AccidentTypeId: this.AccidentTypeId(),
                Name: this.Name(),
                IsUse: this.IsUse(),
            };
        },

        fromJS: function (data) {
            if (data) {
                this.SiteId(data.SiteId);
                this.AccidentTypeId(data.AccidentTypeId);
                this.Name(data.Name);
                this.IsUse(data.IsUse);
            }
        }
    });
})();