text: // --------- This code has been automatically generated !!! 2016-10-20T16:36:05.746Z
  "use strict";
  require("requirish")._(module);
  /**
   * @module opcua.address_space.types
   */
  var assert = require("better-assert");
  var util = require("util");
  var _  = require("underscore");
  var makeNodeId = require("lib/datamodel/nodeid").makeNodeId;
  var schema_helpers =  require("lib/misc/factories_schema_helpers");
  var extract_all_fields                       = schema_helpers.extract_all_fields;
  var resolve_schema_field_types               = schema_helpers.resolve_schema_field_types;
  var initialize_field                         = schema_helpers.initialize_field;
  var initialize_field_array                   = schema_helpers.initialize_field_array;
  var check_options_correctness_against_schema = schema_helpers.check_options_correctness_against_schema;
  var _defaultTypeMap = require("lib/misc/factories_builtin_types")._defaultTypeMap;
  var ec = require("lib/misc/encode_decode");
  var encodeArray = ec.encodeArray;
  var decodeArray = ec.decodeArray;
  var makeExpandedNodeId = ec.makeExpandedNodeId;
  var generate_new_id = require("lib/misc/factories").generate_new_id;
  var _enumerations = require("lib/misc/factories_enumerations")._private._enumerations;
  var schema = require("../schemas/HistoryReadRequest_schema").HistoryReadRequest_Schema;
  var RequestHeader = require("./_auto_generated_RequestHeader").RequestHeader;
  var HistoryReadValueId = require("./_auto_generated_HistoryReadValueId").HistoryReadValueId;
  var BaseUAObject = require("lib/misc/factories_baseobject").BaseUAObject;
  
  //## Define special behavior for Enumeration
  var _enum_properties = {
      "timestampsToReturn": {
          hidden: false,
          enumerable: true,
          configurable: false,
              get: function() {
                  return this.$timestampsToReturn;
              },
              set: function(value) {
                  var coercedValue = _enumerations.TimestampsToReturn.typedEnum.get(value);
                  /* istanbul ignore next */
                  if ( coercedValue === undefined || coercedValue === null) {
                        throw new Error("value cannot be coerced to TimestampsToReturn: " + value);
                  }
                  this.$timestampsToReturn = coercedValue;
              }
      },
      "$timestampsToReturn": {
           configurable: false,
           value: 'aaaa',
           hidden: true,
           writable: true,
           enumerable: false
      },
  };
  
  
  /**
   * 
   * @class HistoryReadRequest
   * @constructor
   * @extends BaseUAObject
   * @param  options {Object}
   * @param  [options.requestHeader] {RequestHeader} 
   * @param  [options.historyReadDetails] {ExtensionObject} Maximum age of the value to be read in milliseconds
   * @param  [options.timestampsToReturn = 3] {TimestampsToReturn} An enumeration that specifies the Timestamps to be returned for each requested Variable Value Attribute.
   * @param  [options.releaseContinuationPoints] {Boolean} 
   * @param  [options.nodesToRead] {HistoryReadValueId[]} List of Nodes and their Attributes to read. For each entry in this list, a StatusCode is returned, and if it indicates success, the Attribute Value is also returned.
   */
  function HistoryReadRequest(options)
  {
      options = options || {};
      /* istanbul ignore next */
      if (schema_helpers.doDebug) { check_options_correctness_against_schema(this,schema,options); }
      var self = this;
      assert(this instanceof BaseUAObject); //  ' keyword "new" is required for constructor call')
      resolve_schema_field_types(schema);
  
      BaseUAObject.call(this,options);
  
      /**
        * 
        * @property requestHeader
        * @type {RequestHeader}
        */
      self.requestHeader =  new RequestHeader( options.requestHeader);
  
      /**
        * Maximum age of the value to be read in milliseconds
        * @property historyReadDetails
        * @type {ExtensionObject}
        */
      self.historyReadDetails = initialize_field(schema.fields[1], options.historyReadDetails);
  
      /**
        * An enumeration that specifies the Timestamps to be returned for each requested Variable Value Attribute.
        * @property timestampsToReturn
        * @type {TimestampsToReturn}
        * @default  3
        */
      self.timestampsToReturn = initialize_field(schema.fields[2], options.timestampsToReturn);
  
      /**
        * 
        * @property releaseContinuationPoints
        * @type {Boolean}
        */
      self.releaseContinuationPoints = initialize_field(schema.fields[3], options.releaseContinuationPoints);
  
      /**
        * List of Nodes and their Attributes to read. For each entry in this list, a StatusCode is returned, and if it indicates success, the Attribute Value is also returned.
        * @property nodesToRead
        * @type {HistoryReadValueId[]}
        */
      self.nodesToRead = [];
      if (options.nodesToRead) {
          assert(_.isArray(options.nodesToRead));
          self.nodesToRead = options.nodesToRead.map(function(e){ return new HistoryReadValueId(e); } );
      }
  
     // Object.preventExtensions(self);
  }
  util.inherits(HistoryReadRequest,BaseUAObject);
  
  //define enumeration properties
  Object.defineProperties(HistoryReadRequest.prototype,_enum_properties);
  HistoryReadRequest.prototype.encodingDefaultBinary = makeExpandedNodeId(664,0);
  HistoryReadRequest.prototype.encodingDefaultXml = makeExpandedNodeId(663,0);
  HistoryReadRequest.prototype._schema = schema;
  
  var encode_ExtensionObject = _defaultTypeMap.ExtensionObject.encode;
  var decode_ExtensionObject = _defaultTypeMap.ExtensionObject.decode;
  var encode_TimestampsToReturn = _enumerations.TimestampsToReturn.encode;
  var decode_TimestampsToReturn = _enumerations.TimestampsToReturn.decode;
  var encode_Boolean = _defaultTypeMap.Boolean.encode;
  var decode_Boolean = _defaultTypeMap.Boolean.decode;
  /**
   * encode the object into a binary stream
   * @method encode
   *
   * @param stream {BinaryStream} 
   */
  HistoryReadRequest.prototype.encode = function(stream,options) {
      // call base class implementation first
      BaseUAObject.prototype.encode.call(this,stream,options);
     this.requestHeader.encode(stream,options);
      encode_ExtensionObject(this.historyReadDetails,stream);
      encode_TimestampsToReturn(this.timestampsToReturn,stream);
      encode_Boolean(this.releaseContinuationPoints,stream);
      encodeArray(this.nodesToRead,stream,function(obj,stream){ obj.encode(stream,options); }); 
  };
  HistoryReadRequest.prototype.decode = function(stream,options) {
      // call base class implementation first
      BaseUAObject.prototype.decode.call(this,stream,options);
      this.requestHeader.decode(stream,options);
      this.historyReadDetails = decode_ExtensionObject(stream,options);
      this.timestampsToReturn = decode_TimestampsToReturn(stream,options);
      this.releaseContinuationPoints = decode_Boolean(stream,options);
      this.nodesToRead = decodeArray(stream, function(stream) { 
         var obj = new HistoryReadValueId();
         obj.decode(stream,options);
         return obj; 
      });
  };
  HistoryReadRequest.possibleFields = (function() {
      return [
          "requestHeader",
           "historyReadDetails",
           "timestampsToReturn",
           "releaseContinuationPoints",
           "nodesToRead"
      ];
  })();
  
  
  exports.HistoryReadRequest = HistoryReadRequest;
  var register_class_definition = require("lib/misc/factories_factories").register_class_definition;
  register_class_definition("HistoryReadRequest",HistoryReadRequest);
  