/**
 * @fileoverview
 * @enhanceable
 * @public
 */
// GENERATED CODE -- DO NOT EDIT!

var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();

goog.exportSymbol('proto.google.api.Context', null, global);
goog.exportSymbol('proto.google.api.ContextRule', null, global);

/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 */
proto.google.api.Context = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.google.api.Context.repeatedFields_, null);
};
goog.inherits(proto.google.api.Context, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  proto.google.api.Context.displayName = 'proto.google.api.Context';
}
/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.google.api.Context.repeatedFields_ = [1];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto suitable for use in Soy templates.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
 *     for transitional soy proto support: http://goto/soy-param-migration
 * @return {!Object}
 */
proto.google.api.Context.prototype.toObject = function(opt_includeInstance) {
  return proto.google.api.Context.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Whether to include the JSPB
 *     instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.google.api.Context} msg The msg instance to transform.
 * @return {!Object}
 */
proto.google.api.Context.toObject = function(includeInstance, msg) {
  var f, obj = {
    rulesList: jspb.Message.toObjectList(msg.getRulesList(),
    proto.google.api.ContextRule.toObject, includeInstance)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


/**
 * Deserializes binary data (in protobuf wire format).
 * @param {jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.google.api.Context}
 */
proto.google.api.Context.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.google.api.Context;
  return proto.google.api.Context.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.google.api.Context} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.google.api.Context}
 */
proto.google.api.Context.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    var field = reader.getFieldNumber();
    switch (field) {
    case 1:
      var value = new proto.google.api.ContextRule;
      reader.readMessage(value,proto.google.api.ContextRule.deserializeBinaryFromReader);
      msg.getRulesList().push(value);
      msg.setRulesList(msg.getRulesList());
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Class method variant: serializes the given message to binary data
 * (in protobuf wire format), writing to the given BinaryWriter.
 * @param {!proto.google.api.Context} message
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.Context.serializeBinaryToWriter = function(message, writer) {
  message.serializeBinaryToWriter(writer);
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.google.api.Context.prototype.serializeBinary = function() {
  var writer = new jspb.BinaryWriter();
  this.serializeBinaryToWriter(writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the message to binary data (in protobuf wire format),
 * writing to the given BinaryWriter.
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.Context.prototype.serializeBinaryToWriter = function (writer) {
  var f = undefined;
  f = this.getRulesList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      1,
      f,
      proto.google.api.ContextRule.serializeBinaryToWriter
    );
  }
};


/**
 * Creates a deep clone of this proto. No data is shared with the original.
 * @return {!proto.google.api.Context} The clone.
 */
proto.google.api.Context.prototype.cloneMessage = function() {
  return /** @type {!proto.google.api.Context} */ (jspb.Message.cloneMessage(this));
};


/**
 * repeated ContextRule rules = 1;
 * If you change this array by adding, removing or replacing elements, or if you
 * replace the array itself, then you must call the setter to update it.
 * @return {!Array.<!proto.google.api.ContextRule>}
 */
proto.google.api.Context.prototype.getRulesList = function() {
  return /** @type{!Array.<!proto.google.api.ContextRule>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.google.api.ContextRule, 1));
};


/** @param {Array.<!proto.google.api.ContextRule>} value  */
proto.google.api.Context.prototype.setRulesList = function(value) {
  jspb.Message.setRepeatedWrapperField(this, 1, value);
};


proto.google.api.Context.prototype.clearRulesList = function() {
  this.setRulesList([]);
};



/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 */
proto.google.api.ContextRule = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.google.api.ContextRule.repeatedFields_, null);
};
goog.inherits(proto.google.api.ContextRule, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  proto.google.api.ContextRule.displayName = 'proto.google.api.ContextRule';
}
/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.google.api.ContextRule.repeatedFields_ = [2,3,4,5];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto suitable for use in Soy templates.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
 * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
 *     for transitional soy proto support: http://goto/soy-param-migration
 * @return {!Object}
 */
proto.google.api.ContextRule.prototype.toObject = function(opt_includeInstance) {
  return proto.google.api.ContextRule.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Whether to include the JSPB
 *     instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.google.api.ContextRule} msg The msg instance to transform.
 * @return {!Object}
 */
proto.google.api.ContextRule.toObject = function(includeInstance, msg) {
  var f, obj = {
    selector: msg.getSelector(),
    requestedList: jspb.Message.getField(msg, 2),
    providedList: jspb.Message.getField(msg, 3),
    allowedRequestExtensionsList: jspb.Message.getField(msg, 4),
    allowedResponseExtensionsList: jspb.Message.getField(msg, 5)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


/**
 * Deserializes binary data (in protobuf wire format).
 * @param {jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.google.api.ContextRule}
 */
proto.google.api.ContextRule.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.google.api.ContextRule;
  return proto.google.api.ContextRule.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.google.api.ContextRule} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.google.api.ContextRule}
 */
proto.google.api.ContextRule.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    var field = reader.getFieldNumber();
    switch (field) {
    case 1:
      var value = /** @type {string} */ (reader.readString());
      msg.setSelector(value);
      break;
    case 2:
      var value = /** @type {string} */ (reader.readString());
      msg.getRequestedList().push(value);
      msg.setRequestedList(msg.getRequestedList());
      break;
    case 3:
      var value = /** @type {string} */ (reader.readString());
      msg.getProvidedList().push(value);
      msg.setProvidedList(msg.getProvidedList());
      break;
    case 4:
      var value = /** @type {string} */ (reader.readString());
      msg.getAllowedRequestExtensionsList().push(value);
      msg.setAllowedRequestExtensionsList(msg.getAllowedRequestExtensionsList());
      break;
    case 5:
      var value = /** @type {string} */ (reader.readString());
      msg.getAllowedResponseExtensionsList().push(value);
      msg.setAllowedResponseExtensionsList(msg.getAllowedResponseExtensionsList());
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Class method variant: serializes the given message to binary data
 * (in protobuf wire format), writing to the given BinaryWriter.
 * @param {!proto.google.api.ContextRule} message
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.ContextRule.serializeBinaryToWriter = function(message, writer) {
  message.serializeBinaryToWriter(writer);
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.google.api.ContextRule.prototype.serializeBinary = function() {
  var writer = new jspb.BinaryWriter();
  this.serializeBinaryToWriter(writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the message to binary data (in protobuf wire format),
 * writing to the given BinaryWriter.
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.ContextRule.prototype.serializeBinaryToWriter = function (writer) {
  var f = undefined;
  f = this.getSelector();
  if (f.length > 0) {
    writer.writeString(
      1,
      f
    );
  }
  f = this.getRequestedList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      2,
      f
    );
  }
  f = this.getProvidedList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      3,
      f
    );
  }
  f = this.getAllowedRequestExtensionsList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      4,
      f
    );
  }
  f = this.getAllowedResponseExtensionsList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      5,
      f
    );
  }
};


/**
 * Creates a deep clone of this proto. No data is shared with the original.
 * @return {!proto.google.api.ContextRule} The clone.
 */
proto.google.api.ContextRule.prototype.cloneMessage = function() {
  return /** @type {!proto.google.api.ContextRule} */ (jspb.Message.cloneMessage(this));
};


/**
 * optional string selector = 1;
 * @return {string}
 */
proto.google.api.ContextRule.prototype.getSelector = function() {
  return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, ""));
};


/** @param {string} value  */
proto.google.api.ContextRule.prototype.setSelector = function(value) {
  jspb.Message.setField(this, 1, value);
};


/**
 * repeated string requested = 2;
 * If you change this array by adding, removing or replacing elements, or if you
 * replace the array itself, then you must call the setter to update it.
 * @return {!Array.<string>}
 */
proto.google.api.ContextRule.prototype.getRequestedList = function() {
  return /** @type {!Array.<string>} */ (jspb.Message.getField(this, 2));
};


/** @param {Array.<string>} value  */
proto.google.api.ContextRule.prototype.setRequestedList = function(value) {
  jspb.Message.setField(this, 2, value || []);
};


proto.google.api.ContextRule.prototype.clearRequestedList = function() {
  jspb.Message.setField(this, 2, []);
};


/**
 * repeated string provided = 3;
 * If you change this array by adding, removing or replacing elements, or if you
 * replace the array itself, then you must call the setter to update it.
 * @return {!Array.<string>}
 */
proto.google.api.ContextRule.prototype.getProvidedList = function() {
  return /** @type {!Array.<string>} */ (jspb.Message.getField(this, 3));
};


/** @param {Array.<string>} value  */
proto.google.api.ContextRule.prototype.setProvidedList = function(value) {
  jspb.Message.setField(this, 3, value || []);
};


proto.google.api.ContextRule.prototype.clearProvidedList = function() {
  jspb.Message.setField(this, 3, []);
};


/**
 * repeated string allowed_request_extensions = 4;
 * If you change this array by adding, removing or replacing elements, or if you
 * replace the array itself, then you must call the setter to update it.
 * @return {!Array.<string>}
 */
proto.google.api.ContextRule.prototype.getAllowedRequestExtensionsList = function() {
  return /** @type {!Array.<string>} */ (jspb.Message.getField(this, 4));
};


/** @param {Array.<string>} value  */
proto.google.api.ContextRule.prototype.setAllowedRequestExtensionsList = function(value) {
  jspb.Message.setField(this, 4, value || []);
};


proto.google.api.ContextRule.prototype.clearAllowedRequestExtensionsList = function() {
  jspb.Message.setField(this, 4, []);
};


/**
 * repeated string allowed_response_extensions = 5;
 * If you change this array by adding, removing or replacing elements, or if you
 * replace the array itself, then you must call the setter to update it.
 * @return {!Array.<string>}
 */
proto.google.api.ContextRule.prototype.getAllowedResponseExtensionsList = function() {
  return /** @type {!Array.<string>} */ (jspb.Message.getField(this, 5));
};


/** @param {Array.<string>} value  */
proto.google.api.ContextRule.prototype.setAllowedResponseExtensionsList = function(value) {
  jspb.Message.setField(this, 5, value || []);
};


proto.google.api.ContextRule.prototype.clearAllowedResponseExtensionsList = function() {
  jspb.Message.setField(this, 5, []);
};


goog.object.extend(exports, proto.google.api);
