/**
 * @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.Backend', null, global);
goog.exportSymbol('proto.google.api.BackendRule', null, global);
goog.exportSymbol('proto.google.api.BackendRule.PathTranslation', 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.Backend = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.google.api.Backend.repeatedFields_, null);
};
goog.inherits(proto.google.api.Backend, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  proto.google.api.Backend.displayName = 'proto.google.api.Backend';
}
/**
 * List of repeated fields within this message type.
 * @private {!Array<number>}
 * @const
 */
proto.google.api.Backend.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.Backend.prototype.toObject = function(opt_includeInstance) {
  return proto.google.api.Backend.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.Backend} msg The msg instance to transform.
 * @return {!Object}
 */
proto.google.api.Backend.toObject = function(includeInstance, msg) {
  var f, obj = {
    rulesList: jspb.Message.toObjectList(msg.getRulesList(),
    proto.google.api.BackendRule.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.Backend}
 */
proto.google.api.Backend.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.google.api.Backend;
  return proto.google.api.Backend.deserializeBinaryFromReader(msg, reader);
};


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


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


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


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


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


proto.google.api.Backend.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.BackendRule = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.google.api.BackendRule.oneofGroups_);
};
goog.inherits(proto.google.api.BackendRule, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  proto.google.api.BackendRule.displayName = 'proto.google.api.BackendRule';
}
/**
 * Oneof group definitions for this message. Each group defines the field
 * numbers belonging to that group. When of these fields' value is set, all
 * other fields in the group are cleared. During deserialization, if multiple
 * fields are encountered for a group, only the last value seen will be kept.
 * @private {!Array<!Array<number>>}
 * @const
 */
proto.google.api.BackendRule.oneofGroups_ = [[7,8]];

/**
 * @enum {number}
 */
proto.google.api.BackendRule.AuthenticationCase = {
  AUTHENTICATION_NOT_SET: 0,
  JWT_AUDIENCE: 7,
  DISABLE_AUTH: 8
};

/**
 * @return {proto.google.api.BackendRule.AuthenticationCase}
 */
proto.google.api.BackendRule.prototype.getAuthenticationCase = function() {
  return /** @type {proto.google.api.BackendRule.AuthenticationCase} */(jspb.Message.computeOneofCase(this, proto.google.api.BackendRule.oneofGroups_[0]));
};



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.BackendRule.prototype.toObject = function(opt_includeInstance) {
  return proto.google.api.BackendRule.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.BackendRule} msg The msg instance to transform.
 * @return {!Object}
 */
proto.google.api.BackendRule.toObject = function(includeInstance, msg) {
  var f, obj = {
    selector: msg.getSelector(),
    address: msg.getAddress(),
    deadline: msg.getDeadline(),
    minDeadline: msg.getMinDeadline(),
    operationDeadline: msg.getOperationDeadline(),
    pathTranslation: msg.getPathTranslation(),
    jwtAudience: jspb.Message.getField(msg, 7),
    disableAuth: jspb.Message.getField(msg, 8),
    protocol: msg.getProtocol()
  };

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


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.google.api.BackendRule} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.google.api.BackendRule}
 */
proto.google.api.BackendRule.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.setAddress(value);
      break;
    case 3:
      var value = /** @type {number} */ (reader.readDouble());
      msg.setDeadline(value);
      break;
    case 4:
      var value = /** @type {number} */ (reader.readDouble());
      msg.setMinDeadline(value);
      break;
    case 5:
      var value = /** @type {number} */ (reader.readDouble());
      msg.setOperationDeadline(value);
      break;
    case 6:
      var value = /** @type {!proto.google.api.BackendRule.PathTranslation} */ (reader.readEnum());
      msg.setPathTranslation(value);
      break;
    case 7:
      var value = /** @type {string} */ (reader.readString());
      msg.setJwtAudience(value);
      break;
    case 8:
      var value = /** @type {boolean} */ (reader.readBool());
      msg.setDisableAuth(value);
      break;
    case 9:
      var value = /** @type {string} */ (reader.readString());
      msg.setProtocol(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.BackendRule} message
 * @param {!jspb.BinaryWriter} writer
 */
proto.google.api.BackendRule.serializeBinaryToWriter = function(message, writer) {
  message.serializeBinaryToWriter(writer);
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.google.api.BackendRule.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.BackendRule.prototype.serializeBinaryToWriter = function (writer) {
  var f = undefined;
  f = this.getSelector();
  if (f.length > 0) {
    writer.writeString(
      1,
      f
    );
  }
  f = this.getAddress();
  if (f.length > 0) {
    writer.writeString(
      2,
      f
    );
  }
  f = this.getDeadline();
  if (f !== 0.0) {
    writer.writeDouble(
      3,
      f
    );
  }
  f = this.getMinDeadline();
  if (f !== 0.0) {
    writer.writeDouble(
      4,
      f
    );
  }
  f = this.getOperationDeadline();
  if (f !== 0.0) {
    writer.writeDouble(
      5,
      f
    );
  }
  f = this.getPathTranslation();
  if (f !== 0.0) {
    writer.writeEnum(
      6,
      f
    );
  }
  f = jspb.Message.getField(this, 7);
  if (f != null) {
    writer.writeString(
      7,
      f
    );
  }
  f = jspb.Message.getField(this, 8);
  if (f != null) {
    writer.writeBool(
      8,
      f
    );
  }
  f = this.getProtocol();
  if (f.length > 0) {
    writer.writeString(
      9,
      f
    );
  }
};


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


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


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


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


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


/**
 * optional double deadline = 3;
 * @return {number}
 */
proto.google.api.BackendRule.prototype.getDeadline = function() {
  return /** @type {number} */ (jspb.Message.getFieldProto3(this, 3, 0));
};


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


/**
 * optional double min_deadline = 4;
 * @return {number}
 */
proto.google.api.BackendRule.prototype.getMinDeadline = function() {
  return /** @type {number} */ (jspb.Message.getFieldProto3(this, 4, 0));
};


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


/**
 * optional double operation_deadline = 5;
 * @return {number}
 */
proto.google.api.BackendRule.prototype.getOperationDeadline = function() {
  return /** @type {number} */ (jspb.Message.getFieldProto3(this, 5, 0));
};


/** @param {number} value  */
proto.google.api.BackendRule.prototype.setOperationDeadline = function(value) {
  jspb.Message.setField(this, 5, value);
};


/**
 * optional PathTranslation path_translation = 6;
 * @return {!proto.google.api.BackendRule.PathTranslation}
 */
proto.google.api.BackendRule.prototype.getPathTranslation = function() {
  return /** @type {!proto.google.api.BackendRule.PathTranslation} */ (jspb.Message.getFieldProto3(this, 6, 0));
};


/** @param {!proto.google.api.BackendRule.PathTranslation} value  */
proto.google.api.BackendRule.prototype.setPathTranslation = function(value) {
  jspb.Message.setField(this, 6, value);
};


/**
 * optional string jwt_audience = 7;
 * @return {string}
 */
proto.google.api.BackendRule.prototype.getJwtAudience = function() {
  return /** @type {string} */ (!this.hasJwtAudience() ? "" : jspb.Message.getField(this, 7));
};


/** @param {string?|undefined} value  */
proto.google.api.BackendRule.prototype.setJwtAudience = function(value) {
  jspb.Message.setOneofField(this, 7, proto.google.api.BackendRule.oneofGroups_[0], value);
};


proto.google.api.BackendRule.prototype.clearJwtAudience = function() {
  jspb.Message.setOneofField(this, 7, proto.google.api.BackendRule.oneofGroups_[0], undefined);
};


/**
 * Returns whether this field is set.
 * @return{!boolean}
 */
proto.google.api.BackendRule.prototype.hasJwtAudience = function() {
  return jspb.Message.getField(this, 7) != null;
};


/**
 * optional bool disable_auth = 8;
 * 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.BackendRule.prototype.getDisableAuth = function() {
  return /** @type {boolean} */ (!this.hasDisableAuth() ? false : jspb.Message.getField(this, 8));
};


/** @param {boolean?|undefined} value  */
proto.google.api.BackendRule.prototype.setDisableAuth = function(value) {
  jspb.Message.setOneofField(this, 8, proto.google.api.BackendRule.oneofGroups_[0], value);
};


proto.google.api.BackendRule.prototype.clearDisableAuth = function() {
  jspb.Message.setOneofField(this, 8, proto.google.api.BackendRule.oneofGroups_[0], undefined);
};


/**
 * Returns whether this field is set.
 * @return{!boolean}
 */
proto.google.api.BackendRule.prototype.hasDisableAuth = function() {
  return jspb.Message.getField(this, 8) != null;
};


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


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


/**
 * @enum {number}
 */
proto.google.api.BackendRule.PathTranslation = {
  PATH_TRANSLATION_UNSPECIFIED: 0,
  CONSTANT_ADDRESS: 1,
  APPEND_PATH_TO_ADDRESS: 2
};

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