/**
 * @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.Usage', null, global);
goog.exportSymbol('proto.google.api.UsageRule', 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.Usage = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.google.api.Usage.repeatedFields_, null);
};
goog.inherits(proto.google.api.Usage, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  proto.google.api.Usage.displayName = 'proto.google.api.Usage';
}
/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.google.api.Usage.repeatedFields_ = [1,6];



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.Usage.prototype.toObject = function(opt_includeInstance) {
  return proto.google.api.Usage.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.Usage} msg The msg instance to transform.
 * @return {!Object}
 */
proto.google.api.Usage.toObject = function(includeInstance, msg) {
  var f, obj = {
    requirementsList: jspb.Message.getField(msg, 1),
    rulesList: jspb.Message.toObjectList(msg.getRulesList(),
    proto.google.api.UsageRule.toObject, includeInstance),
    producerNotificationChannel: msg.getProducerNotificationChannel()
  };

  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.Usage}
 */
proto.google.api.Usage.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.google.api.Usage;
  return proto.google.api.Usage.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.google.api.Usage} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.google.api.Usage}
 */
proto.google.api.Usage.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.getRequirementsList().push(value);
      msg.setRequirementsList(msg.getRequirementsList());
      break;
    case 6:
      var value = new proto.google.api.UsageRule;
      reader.readMessage(value,proto.google.api.UsageRule.deserializeBinaryFromReader);
      msg.getRulesList().push(value);
      msg.setRulesList(msg.getRulesList());
      break;
    case 7:
      var value = /** @type {string} */ (reader.readString());
      msg.setProducerNotificationChannel(value);
      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.Usage} message
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.Usage.serializeBinaryToWriter = function(message, writer) {
  message.serializeBinaryToWriter(writer);
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.google.api.Usage.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.Usage.prototype.serializeBinaryToWriter = function (writer) {
  var f = undefined;
  f = this.getRequirementsList();
  if (f.length > 0) {
    writer.writeRepeatedString(
      1,
      f
    );
  }
  f = this.getRulesList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      6,
      f,
      proto.google.api.UsageRule.serializeBinaryToWriter
    );
  }
  f = this.getProducerNotificationChannel();
  if (f.length > 0) {
    writer.writeString(
      7,
      f
    );
  }
};


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


/**
 * repeated string requirements = 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.<string>}
 */
proto.google.api.Usage.prototype.getRequirementsList = function() {
  return /** @type {!Array.<string>} */ (jspb.Message.getField(this, 1));
};


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


proto.google.api.Usage.prototype.clearRequirementsList = function() {
  jspb.Message.setField(this, 1, []);
};


/**
 * repeated UsageRule rules = 6;
 * 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.UsageRule>}
 */
proto.google.api.Usage.prototype.getRulesList = function() {
  return /** @type{!Array.<!proto.google.api.UsageRule>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.google.api.UsageRule, 6));
};


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


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


/**
 * optional string producer_notification_channel = 7;
 * @return {string}
 */
proto.google.api.Usage.prototype.getProducerNotificationChannel = function() {
  return /** @type {string} */ (jspb.Message.getFieldProto3(this, 7, ""));
};


/** @param {string} value  */
proto.google.api.Usage.prototype.setProducerNotificationChannel = function(value) {
  jspb.Message.setField(this, 7, value);
};



/**
 * 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.UsageRule = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.google.api.UsageRule, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  proto.google.api.UsageRule.displayName = 'proto.google.api.UsageRule';
}


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.UsageRule.prototype.toObject = function(opt_includeInstance) {
  return proto.google.api.UsageRule.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.UsageRule} msg The msg instance to transform.
 * @return {!Object}
 */
proto.google.api.UsageRule.toObject = function(includeInstance, msg) {
  var f, obj = {
    selector: msg.getSelector(),
    allowUnregisteredCalls: msg.getAllowUnregisteredCalls(),
    skipServiceControl: msg.getSkipServiceControl()
  };

  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.UsageRule}
 */
proto.google.api.UsageRule.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.google.api.UsageRule;
  return proto.google.api.UsageRule.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.google.api.UsageRule} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.google.api.UsageRule}
 */
proto.google.api.UsageRule.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 {boolean} */ (reader.readBool());
      msg.setAllowUnregisteredCalls(value);
      break;
    case 3:
      var value = /** @type {boolean} */ (reader.readBool());
      msg.setSkipServiceControl(value);
      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.UsageRule} message
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.UsageRule.serializeBinaryToWriter = function(message, writer) {
  message.serializeBinaryToWriter(writer);
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.google.api.UsageRule.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.UsageRule.prototype.serializeBinaryToWriter = function (writer) {
  var f = undefined;
  f = this.getSelector();
  if (f.length > 0) {
    writer.writeString(
      1,
      f
    );
  }
  f = this.getAllowUnregisteredCalls();
  if (f) {
    writer.writeBool(
      2,
      f
    );
  }
  f = this.getSkipServiceControl();
  if (f) {
    writer.writeBool(
      3,
      f
    );
  }
};


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


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


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


/**
 * optional bool allow_unregistered_calls = 2;
 * Note that Boolean fields may be set to 0/1 when serialized from a Java server.
 * You should avoid comparisons like {@code val === true/false} in those cases.
 * @return {boolean}
 */
proto.google.api.UsageRule.prototype.getAllowUnregisteredCalls = function() {
  return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 2, false));
};


/** @param {boolean} value  */
proto.google.api.UsageRule.prototype.setAllowUnregisteredCalls = function(value) {
  jspb.Message.setField(this, 2, value);
};


/**
 * optional bool skip_service_control = 3;
 * Note that Boolean fields may be set to 0/1 when serialized from a Java server.
 * You should avoid comparisons like {@code val === true/false} in those cases.
 * @return {boolean}
 */
proto.google.api.UsageRule.prototype.getSkipServiceControl = function() {
  return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 3, false));
};


/** @param {boolean} value  */
proto.google.api.UsageRule.prototype.setSkipServiceControl = function(value) {
  jspb.Message.setField(this, 3, value);
};


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