(function() {
    BemsWebApplication.FmsWorkOperationTimeViewModel = function(data) {
            this.SiteId = ko.observable();
            this.FacilityCode = ko.observable();
            this.CheckDatetime = ko.observable();
            this.InsertedDate = ko.observable();
            this.InsertedUserId = ko.observable();
            this.UpdatedDate = ko.observable();
            this.UpdatedUserId = ko.observable();
            if(data)
                this.fromJS(data);
    };

    $.extend(BemsWebApplication.FmsWorkOperationTimeViewModel.prototype, {
        toJS: function() {
            return {
                SiteId: this.SiteId(),
                FacilityCode: this.FacilityCode(),
                CheckDatetime: this.CheckDatetime(),
                InsertedDate: this.InsertedDate(),
                InsertedUserId: this.InsertedUserId(),
                UpdatedDate: this.UpdatedDate(),
                UpdatedUserId: this.UpdatedUserId(),
            };
        },

        fromJS: function(data) {
            if(data) {
                this.SiteId(data.SiteId);
                this.FacilityCode(data.FacilityCode);
                this.CheckDatetime(data.CheckDatetime);
                this.InsertedDate(data.InsertedDate);
                this.InsertedUserId(data.InsertedUserId);
                this.UpdatedDate(data.UpdatedDate);
                this.UpdatedUserId(data.UpdatedUserId);

            }
        }
    });
})();