(function () {
    BemsWebApplication.CmPatrolHistoryExViewModel = function (data) {
        this.SiteId = ko.observable();
        this.PatrolHistoryId = ko.observable();
        this.PlanId = ko.observable();
        this.startDate = ko.observable();
        this.endDate = ko.observable();
        this.resultTypeId = ko.observable();
        this.resultDesc = ko.observable();
        //2016 09 26 �߰�
        this.resultPosCnt = ko.observable();
        this.resultNormalCnt = ko.observable();
        this.resultAbnormalCnt = ko.observable();

        this.TotalCnt = ko.observable();
        this.OkCnt = ko.observable();
        this.ErrorCnt = ko.observable();
        this.TotalTimeMin = ko.observable();

        if (data)
            this.fromJS(data);
    };

    $.extend(BemsWebApplication.CmPatrolHistoryExViewModel.prototype, {
        toJS: function () {
            return {
                SiteId: this.SiteId(),
                PatrolHistoryId: this.PatrolHistoryId(),
                PlanId: this.PlanId(),
                startDate: this.startDate(),
                endDate: this.endDate(),
                resultTypeId: this.resultTypeId(),
                resultDesc: this.resultDesc(),

                resultPosCnt: this.resultPosCnt(),
                resultNormalCnt: this.resultNormalCnt(),
                resultAbnormalCnt: this.resultAbnormalCnt(),

                TotalCnt: this.TotalCnt(),
                OkCnt: this.OkCnt(),
                ErrorCnt: this.ErrorCnt(),
                TotalTimeMin: this.TotalTimeMin(),

            };
        },

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

                this.resultPosCnt(data.resultPosCnt);
                this.resultNormalCnt(data.resultNormalCnt);
                this.resultAbnormalCnt(data.resultAbnormalCnt);

                this.TotalCnt(data.TotalCnt);
                this.OkCnt(data.OkCnt);
                this.ErrorCnt(data.ErrorCnt);
                this.TotalTimeMin(data.TotalTimeMin);
            }
        }
    });
})();