(function () {
    BemsWebApplication.CmPatrolHistoryViewModel = function (data) {
        this.SiteId = ko.observable();
        this.PatrolHistoryId = ko.observable();
        this.ScheduleId = ko.observable();
        this.startDate = ko.observable();
        this.endDate = ko.observable();
        this.resultTypeId = ko.observable();
        this.resultDesc = ko.observable();
        if (data)
            this.fromJS(data);
    };

    $.extend(BemsWebApplication.CmPatrolHistoryViewModel.prototype, {
        toJS: function () {
            return {
                SiteId: this.SiteId(),
                PatrolHistoryId: this.PatrolHistoryId(),
                ScheduleId: this.ScheduleId(),
                startDate: this.startDate(),
                endDate: this.endDate(),
                resultTypeId: this.resultTypeId(),
                resultDesc: this.resultDesc(),
            };
        },

        fromJS: function (data) {
            if (data) {
                this.SiteId(data.SiteId);
                this.PatrolHistoryId(data.PatrolHistoryId);
                this.ScheduleId(data.ScheduleId);
                this.startDate(data.startDate);
                this.endDate(data.endDate);
                this.resultTypeId(data.resultTypeId);
                this.resultDesc(data.resultDesc);
            }
        }
    });
})();