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



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.Quota.prototype.toObject = function(opt_includeInstance) {
  return proto.google.api.Quota.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.Quota} msg The msg instance to transform.
 * @return {!Object}
 */
proto.google.api.Quota.toObject = function(includeInstance, msg) {
  var f, obj = {
    limitsList: jspb.Message.toObjectList(msg.getLimitsList(),
    proto.google.api.QuotaLimit.toObject, includeInstance),
    metricRulesList: jspb.Message.toObjectList(msg.getMetricRulesList(),
    proto.google.api.MetricRule.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.Quota}
 */
proto.google.api.Quota.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.google.api.Quota;
  return proto.google.api.Quota.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.google.api.Quota} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.google.api.Quota}
 */
proto.google.api.Quota.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    var field = reader.getFieldNumber();
    switch (field) {
    case 3:
      var value = new proto.google.api.QuotaLimit;
      reader.readMessage(value,proto.google.api.QuotaLimit.deserializeBinaryFromReader);
      msg.getLimitsList().push(value);
      msg.setLimitsList(msg.getLimitsList());
      break;
    case 4:
      var value = new proto.google.api.MetricRule;
      reader.readMessage(value,proto.google.api.MetricRule.deserializeBinaryFromReader);
      msg.getMetricRulesList().push(value);
      msg.setMetricRulesList(msg.getMetricRulesList());
      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.Quota} message
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.Quota.serializeBinaryToWriter = function(message, writer) {
  message.serializeBinaryToWriter(writer);
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.google.api.Quota.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.Quota.prototype.serializeBinaryToWriter = function (writer) {
  var f = undefined;
  f = this.getLimitsList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      3,
      f,
      proto.google.api.QuotaLimit.serializeBinaryToWriter
    );
  }
  f = this.getMetricRulesList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      4,
      f,
      proto.google.api.MetricRule.serializeBinaryToWriter
    );
  }
};


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


/**
 * repeated QuotaLimit limits = 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.<!proto.google.api.QuotaLimit>}
 */
proto.google.api.Quota.prototype.getLimitsList = function() {
  return /** @type{!Array.<!proto.google.api.QuotaLimit>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.google.api.QuotaLimit, 3));
};


/** @param {Array.<!proto.google.api.QuotaLimit>} value  */
proto.google.api.Quota.prototype.setLimitsList = function(value) {
  jspb.Message.setRepeatedWrapperField(this, 3, value);
};


proto.google.api.Quota.prototype.clearLimitsList = function() {
  this.setLimitsList([]);
};


/**
 * repeated MetricRule metric_rules = 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.<!proto.google.api.MetricRule>}
 */
proto.google.api.Quota.prototype.getMetricRulesList = function() {
  return /** @type{!Array.<!proto.google.api.MetricRule>} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.google.api.MetricRule, 4));
};


/** @param {Array.<!proto.google.api.MetricRule>} value  */
proto.google.api.Quota.prototype.setMetricRulesList = function(value) {
  jspb.Message.setRepeatedWrapperField(this, 4, value);
};


proto.google.api.Quota.prototype.clearMetricRulesList = function() {
  this.setMetricRulesList([]);
};



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


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.MetricRule.prototype.toObject = function(opt_includeInstance) {
  return proto.google.api.MetricRule.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.MetricRule} msg The msg instance to transform.
 * @return {!Object}
 */
proto.google.api.MetricRule.toObject = function(includeInstance, msg) {
  var f, obj = {
    selector: msg.getSelector(),
    metricCostsMap: (f = msg.getMetricCostsMap(true)) ? f.toArray() : []
  };

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


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.google.api.MetricRule} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.google.api.MetricRule}
 */
proto.google.api.MetricRule.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 = msg.getMetricCostsMap();
      reader.readMessage(value, function(message, reader) {
        jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt64);
         });
      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.MetricRule} message
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.MetricRule.serializeBinaryToWriter = function(message, writer) {
  message.serializeBinaryToWriter(writer);
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.google.api.MetricRule.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.MetricRule.prototype.serializeBinaryToWriter = function (writer) {
  var f = undefined;
  f = this.getSelector();
  if (f.length > 0) {
    writer.writeString(
      1,
      f
    );
  }
  f = this.getMetricCostsMap(true);
  if (f && f.getLength() > 0) {
    f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt64);
  }
};


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


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


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


/**
 * map<string, int64> metric_costs = 2;
 * @param {boolean=} opt_noLazyCreate Do not create the map if
 * empty, instead returning `undefined`
 * @return {!jspb.Map<string,number>}
 */
proto.google.api.MetricRule.prototype.getMetricCostsMap = function(opt_noLazyCreate) {
  return /** @type {!jspb.Map<string,number>} */ (
      jspb.Message.getMapField(this, 2, opt_noLazyCreate,
      null));
};



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


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.QuotaLimit.prototype.toObject = function(opt_includeInstance) {
  return proto.google.api.QuotaLimit.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.QuotaLimit} msg The msg instance to transform.
 * @return {!Object}
 */
proto.google.api.QuotaLimit.toObject = function(includeInstance, msg) {
  var f, obj = {
    name: msg.getName(),
    description: msg.getDescription(),
    defaultLimit: msg.getDefaultLimit(),
    maxLimit: msg.getMaxLimit(),
    freeTier: msg.getFreeTier(),
    duration: msg.getDuration(),
    metric: msg.getMetric(),
    unit: msg.getUnit(),
    valuesMap: (f = msg.getValuesMap(true)) ? f.toArray() : [],
    displayName: msg.getDisplayName()
  };

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


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.google.api.QuotaLimit} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.google.api.QuotaLimit}
 */
proto.google.api.QuotaLimit.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    var field = reader.getFieldNumber();
    switch (field) {
    case 6:
      var value = /** @type {string} */ (reader.readString());
      msg.setName(value);
      break;
    case 2:
      var value = /** @type {string} */ (reader.readString());
      msg.setDescription(value);
      break;
    case 3:
      var value = /** @type {number} */ (reader.readInt64());
      msg.setDefaultLimit(value);
      break;
    case 4:
      var value = /** @type {number} */ (reader.readInt64());
      msg.setMaxLimit(value);
      break;
    case 7:
      var value = /** @type {number} */ (reader.readInt64());
      msg.setFreeTier(value);
      break;
    case 5:
      var value = /** @type {string} */ (reader.readString());
      msg.setDuration(value);
      break;
    case 8:
      var value = /** @type {string} */ (reader.readString());
      msg.setMetric(value);
      break;
    case 9:
      var value = /** @type {string} */ (reader.readString());
      msg.setUnit(value);
      break;
    case 10:
      var value = msg.getValuesMap();
      reader.readMessage(value, function(message, reader) {
        jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt64);
         });
      break;
    case 12:
      var value = /** @type {string} */ (reader.readString());
      msg.setDisplayName(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.QuotaLimit} message
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.QuotaLimit.serializeBinaryToWriter = function(message, writer) {
  message.serializeBinaryToWriter(writer);
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.google.api.QuotaLimit.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.QuotaLimit.prototype.serializeBinaryToWriter = function (writer) {
  var f = undefined;
  f = this.getName();
  if (f.length > 0) {
    writer.writeString(
      6,
      f
    );
  }
  f = this.getDescription();
  if (f.length > 0) {
    writer.writeString(
      2,
      f
    );
  }
  f = this.getDefaultLimit();
  if (f !== 0) {
    writer.writeInt64(
      3,
      f
    );
  }
  f = this.getMaxLimit();
  if (f !== 0) {
    writer.writeInt64(
      4,
      f
    );
  }
  f = this.getFreeTier();
  if (f !== 0) {
    writer.writeInt64(
      7,
      f
    );
  }
  f = this.getDuration();
  if (f.length > 0) {
    writer.writeString(
      5,
      f
    );
  }
  f = this.getMetric();
  if (f.length > 0) {
    writer.writeString(
      8,
      f
    );
  }
  f = this.getUnit();
  if (f.length > 0) {
    writer.writeString(
      9,
      f
    );
  }
  f = this.getValuesMap(true);
  if (f && f.getLength() > 0) {
    f.serializeBinary(10, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt64);
  }
  f = this.getDisplayName();
  if (f.length > 0) {
    writer.writeString(
      12,
      f
    );
  }
};


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


/**
 * optional string name = 6;
 * @return {string}
 */
proto.google.api.QuotaLimit.prototype.getName = function() {
  return /** @type {string} */ (jspb.Message.getFieldProto3(this, 6, ""));
};


/** @param {string} value  */
proto.google.api.QuotaLimit.prototype.setName = function(value) {
  jspb.Message.setField(this, 6, value);
};


/**
 * optional string description = 2;
 * @return {string}
 */
proto.google.api.QuotaLimit.prototype.getDescription = function() {
  return /** @type {string} */ (jspb.Message.getFieldProto3(this, 2, ""));
};


/** @param {string} value  */
proto.google.api.QuotaLimit.prototype.setDescription = function(value) {
  jspb.Message.setField(this, 2, value);
};


/**
 * optional int64 default_limit = 3;
 * @return {number}
 */
proto.google.api.QuotaLimit.prototype.getDefaultLimit = function() {
  return /** @type {number} */ (jspb.Message.getFieldProto3(this, 3, 0));
};


/** @param {number} value  */
proto.google.api.QuotaLimit.prototype.setDefaultLimit = function(value) {
  jspb.Message.setField(this, 3, value);
};


/**
 * optional int64 max_limit = 4;
 * @return {number}
 */
proto.google.api.QuotaLimit.prototype.getMaxLimit = function() {
  return /** @type {number} */ (jspb.Message.getFieldProto3(this, 4, 0));
};


/** @param {number} value  */
proto.google.api.QuotaLimit.prototype.setMaxLimit = function(value) {
  jspb.Message.setField(this, 4, value);
};


/**
 * optional int64 free_tier = 7;
 * @return {number}
 */
proto.google.api.QuotaLimit.prototype.getFreeTier = function() {
  return /** @type {number} */ (jspb.Message.getFieldProto3(this, 7, 0));
};


/** @param {number} value  */
proto.google.api.QuotaLimit.prototype.setFreeTier = function(value) {
  jspb.Message.setField(this, 7, value);
};


/**
 * optional string duration = 5;
 * @return {string}
 */
proto.google.api.QuotaLimit.prototype.getDuration = function() {
  return /** @type {string} */ (jspb.Message.getFieldProto3(this, 5, ""));
};


/** @param {string} value  */
proto.google.api.QuotaLimit.prototype.setDuration = function(value) {
  jspb.Message.setField(this, 5, value);
};


/**
 * optional string metric = 8;
 * @return {string}
 */
proto.google.api.QuotaLimit.prototype.getMetric = function() {
  return /** @type {string} */ (jspb.Message.getFieldProto3(this, 8, ""));
};


/** @param {string} value  */
proto.google.api.QuotaLimit.prototype.setMetric = function(value) {
  jspb.Message.setField(this, 8, value);
};


/**
 * optional string unit = 9;
 * @return {string}
 */
proto.google.api.QuotaLimit.prototype.getUnit = function() {
  return /** @type {string} */ (jspb.Message.getFieldProto3(this, 9, ""));
};


/** @param {string} value  */
proto.google.api.QuotaLimit.prototype.setUnit = function(value) {
  jspb.Message.setField(this, 9, value);
};


/**
 * map<string, int64> values = 10;
 * @param {boolean=} opt_noLazyCreate Do not create the map if
 * empty, instead returning `undefined`
 * @return {!jspb.Map<string,number>}
 */
proto.google.api.QuotaLimit.prototype.getValuesMap = function(opt_noLazyCreate) {
  return /** @type {!jspb.Map<string,number>} */ (
      jspb.Message.getMapField(this, 10, opt_noLazyCreate,
      null));
};


/**
 * optional string display_name = 12;
 * @return {string}
 */
proto.google.api.QuotaLimit.prototype.getDisplayName = function() {
  return /** @type {string} */ (jspb.Message.getFieldProto3(this, 12, ""));
};


/** @param {string} value  */
proto.google.api.QuotaLimit.prototype.setDisplayName = function(value) {
  jspb.Message.setField(this, 12, value);
};


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