(function () {
    BemsWebApplication.BemsMonitoringWeatherForecastedViewModel = function (data) {
        this.SiteId = ko.observable();
        this.CreatedDateTime = ko.observable();
        this.Category = ko.observable();
        this.BaseDateTime = ko.observable();
        this.ForecastedDateTime = ko.observable();
        this.ForecastedValue = ko.observable();
        this.nx = ko.observable();
        this.ny = ko.observable();
        if (data)
            this.fromJS(data);
    };

    $.extend(BemsWebApplication.BemsMonitoringWeatherForecastedViewModel.prototype, {
        toJS: function () {
            return {
                SiteId: this.SiteId(),
                CreatedDateTime: this.CreatedDateTime(),
                Category: this.Category(),
                BaseDateTime: this.BaseDateTime(),
                ForecastedDateTime: this.ForecastedDateTime(),
                ForecastedValue: this.ForecastedValue(),
                nx: this.nx(),
                ny: this.ny()
            };
        },

        fromJS: function (data) {
            if (data) {
                this.SiteId(data.SiteId);
                this.CreatedDateTime(data.CreatedDateTime);
                this.Category(data.Category);
                this.BaseDateTime(data.BaseDateTime);
                this.ForecastedDateTime(data.ForecastedDateTime);
                this.ForecastedValue(data.ForecastedValue);
                this.nx(data.nx);
                this.ny(data.ny);
            }
        }
    });
})();