(function () {
    BemsWebApplication.CmPatrolScheduleViewModel = function (data) {
        this.SiteId = ko.observable();
        this.PlanId = ko.observable();
        this.ScheduleId = ko.observable();
        this.Name = ko.observable();
        this.ScheduleDesc = ko.observable();
        this.inDate = ko.observable();
        this.patrolDateTime = ko.observable();
        if (data)
            this.fromJS(data);
    };

    $.extend(BemsWebApplication.CmPatrolScheduleViewModel.prototype, {
        toJS: function () {
            return {
                SiteId: this.SiteId(),
                PlanId: this.PlanId(),
                ScheduleId: this.ScheduleId(),
                Name: this.Name(),
                ScheduleDesc: this.ScheduleDesc(),
                inDate: this.inDate(),
                patrolDateTime: this.patrolDateTime(),
            };
        },

        fromJS: function (data) {
            if (data) {
                this.SiteId(data.SiteId);
                this.PlanId(data.PlanId);
                this.ScheduleId(data.ScheduleId);
                this.Name(data.Name);
                this.ScheduleDesc(data.ScheduleDesc);
                this.patrolDateTime(data.patrolDateTime);
                this.inDate(data.inDate);

            }
        }
    });
})();