/*
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/identity/accesscontextmanager/v1/access_level.proto

package com.google.identity.accesscontextmanager.v1;

/**
 *
 *
 * <pre>
 * A condition necessary for an `AccessLevel` to be granted. The Condition is an
 * AND over its fields. So a Condition is true if: 1) the request IP is from one
 * of the listed subnetworks AND 2) the originating device complies with the
 * listed device policy AND 3) all listed access levels are granted AND 4) the
 * request was sent at a time allowed by the DateTimeRestriction.
 * </pre>
 *
 * Protobuf type {@code google.identity.accesscontextmanager.v1.Condition}
 */
public final class Condition extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.identity.accesscontextmanager.v1.Condition)
    ConditionOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use Condition.newBuilder() to construct.
  private Condition(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private Condition() {
    ipSubnetworks_ = com.google.protobuf.LazyStringArrayList.EMPTY;
    requiredAccessLevels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
    members_ = com.google.protobuf.LazyStringArrayList.EMPTY;
    regions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new Condition();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.identity.accesscontextmanager.v1.AccessLevelProto
        .internal_static_google_identity_accesscontextmanager_v1_Condition_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.identity.accesscontextmanager.v1.AccessLevelProto
        .internal_static_google_identity_accesscontextmanager_v1_Condition_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.identity.accesscontextmanager.v1.Condition.class,
            com.google.identity.accesscontextmanager.v1.Condition.Builder.class);
  }

  public static final int IP_SUBNETWORKS_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private com.google.protobuf.LazyStringList ipSubnetworks_;
  /**
   *
   *
   * <pre>
   * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
   * a CIDR IP address block, the specified IP address portion must be properly
   * truncated (i.e. all the host bits must be zero) or the input is considered
   * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
   * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
   * "2001:db8::1/32" is not. The originating IP of a request must be in one of
   * the listed subnets in order for this Condition to be true. If empty, all IP
   * addresses are allowed.
   * </pre>
   *
   * <code>repeated string ip_subnetworks = 1;</code>
   *
   * @return A list containing the ipSubnetworks.
   */
  public com.google.protobuf.ProtocolStringList getIpSubnetworksList() {
    return ipSubnetworks_;
  }
  /**
   *
   *
   * <pre>
   * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
   * a CIDR IP address block, the specified IP address portion must be properly
   * truncated (i.e. all the host bits must be zero) or the input is considered
   * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
   * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
   * "2001:db8::1/32" is not. The originating IP of a request must be in one of
   * the listed subnets in order for this Condition to be true. If empty, all IP
   * addresses are allowed.
   * </pre>
   *
   * <code>repeated string ip_subnetworks = 1;</code>
   *
   * @return The count of ipSubnetworks.
   */
  public int getIpSubnetworksCount() {
    return ipSubnetworks_.size();
  }
  /**
   *
   *
   * <pre>
   * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
   * a CIDR IP address block, the specified IP address portion must be properly
   * truncated (i.e. all the host bits must be zero) or the input is considered
   * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
   * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
   * "2001:db8::1/32" is not. The originating IP of a request must be in one of
   * the listed subnets in order for this Condition to be true. If empty, all IP
   * addresses are allowed.
   * </pre>
   *
   * <code>repeated string ip_subnetworks = 1;</code>
   *
   * @param index The index of the element to return.
   * @return The ipSubnetworks at the given index.
   */
  public java.lang.String getIpSubnetworks(int index) {
    return ipSubnetworks_.get(index);
  }
  /**
   *
   *
   * <pre>
   * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
   * a CIDR IP address block, the specified IP address portion must be properly
   * truncated (i.e. all the host bits must be zero) or the input is considered
   * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
   * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
   * "2001:db8::1/32" is not. The originating IP of a request must be in one of
   * the listed subnets in order for this Condition to be true. If empty, all IP
   * addresses are allowed.
   * </pre>
   *
   * <code>repeated string ip_subnetworks = 1;</code>
   *
   * @param index The index of the value to return.
   * @return The bytes of the ipSubnetworks at the given index.
   */
  public com.google.protobuf.ByteString getIpSubnetworksBytes(int index) {
    return ipSubnetworks_.getByteString(index);
  }

  public static final int DEVICE_POLICY_FIELD_NUMBER = 2;
  private com.google.identity.accesscontextmanager.v1.DevicePolicy devicePolicy_;
  /**
   *
   *
   * <pre>
   * Device specific restrictions, all restrictions must hold for the
   * Condition to be true. If not specified, all devices are allowed.
   * </pre>
   *
   * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
   *
   * @return Whether the devicePolicy field is set.
   */
  @java.lang.Override
  public boolean hasDevicePolicy() {
    return devicePolicy_ != null;
  }
  /**
   *
   *
   * <pre>
   * Device specific restrictions, all restrictions must hold for the
   * Condition to be true. If not specified, all devices are allowed.
   * </pre>
   *
   * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
   *
   * @return The devicePolicy.
   */
  @java.lang.Override
  public com.google.identity.accesscontextmanager.v1.DevicePolicy getDevicePolicy() {
    return devicePolicy_ == null
        ? com.google.identity.accesscontextmanager.v1.DevicePolicy.getDefaultInstance()
        : devicePolicy_;
  }
  /**
   *
   *
   * <pre>
   * Device specific restrictions, all restrictions must hold for the
   * Condition to be true. If not specified, all devices are allowed.
   * </pre>
   *
   * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
   */
  @java.lang.Override
  public com.google.identity.accesscontextmanager.v1.DevicePolicyOrBuilder
      getDevicePolicyOrBuilder() {
    return devicePolicy_ == null
        ? com.google.identity.accesscontextmanager.v1.DevicePolicy.getDefaultInstance()
        : devicePolicy_;
  }

  public static final int REQUIRED_ACCESS_LEVELS_FIELD_NUMBER = 3;

  @SuppressWarnings("serial")
  private com.google.protobuf.LazyStringList requiredAccessLevels_;
  /**
   *
   *
   * <pre>
   * A list of other access levels defined in the same `Policy`, referenced by
   * resource name. Referencing an `AccessLevel` which does not exist is an
   * error. All access levels listed must be granted for the Condition
   * to be true. Example:
   * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
   * </pre>
   *
   * <code>repeated string required_access_levels = 3;</code>
   *
   * @return A list containing the requiredAccessLevels.
   */
  public com.google.protobuf.ProtocolStringList getRequiredAccessLevelsList() {
    return requiredAccessLevels_;
  }
  /**
   *
   *
   * <pre>
   * A list of other access levels defined in the same `Policy`, referenced by
   * resource name. Referencing an `AccessLevel` which does not exist is an
   * error. All access levels listed must be granted for the Condition
   * to be true. Example:
   * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
   * </pre>
   *
   * <code>repeated string required_access_levels = 3;</code>
   *
   * @return The count of requiredAccessLevels.
   */
  public int getRequiredAccessLevelsCount() {
    return requiredAccessLevels_.size();
  }
  /**
   *
   *
   * <pre>
   * A list of other access levels defined in the same `Policy`, referenced by
   * resource name. Referencing an `AccessLevel` which does not exist is an
   * error. All access levels listed must be granted for the Condition
   * to be true. Example:
   * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
   * </pre>
   *
   * <code>repeated string required_access_levels = 3;</code>
   *
   * @param index The index of the element to return.
   * @return The requiredAccessLevels at the given index.
   */
  public java.lang.String getRequiredAccessLevels(int index) {
    return requiredAccessLevels_.get(index);
  }
  /**
   *
   *
   * <pre>
   * A list of other access levels defined in the same `Policy`, referenced by
   * resource name. Referencing an `AccessLevel` which does not exist is an
   * error. All access levels listed must be granted for the Condition
   * to be true. Example:
   * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
   * </pre>
   *
   * <code>repeated string required_access_levels = 3;</code>
   *
   * @param index The index of the value to return.
   * @return The bytes of the requiredAccessLevels at the given index.
   */
  public com.google.protobuf.ByteString getRequiredAccessLevelsBytes(int index) {
    return requiredAccessLevels_.getByteString(index);
  }

  public static final int NEGATE_FIELD_NUMBER = 5;
  private boolean negate_ = false;
  /**
   *
   *
   * <pre>
   * Whether to negate the Condition. If true, the Condition becomes a NAND over
   * its non-empty fields, each field must be false for the Condition overall to
   * be satisfied. Defaults to false.
   * </pre>
   *
   * <code>bool negate = 5;</code>
   *
   * @return The negate.
   */
  @java.lang.Override
  public boolean getNegate() {
    return negate_;
  }

  public static final int MEMBERS_FIELD_NUMBER = 6;

  @SuppressWarnings("serial")
  private com.google.protobuf.LazyStringList members_;
  /**
   *
   *
   * <pre>
   * The request must be made by one of the provided user or service
   * accounts. Groups are not supported.
   * Syntax:
   * `user:{emailid}`
   * `serviceAccount:{emailid}`
   * If not specified, a request may come from any user.
   * </pre>
   *
   * <code>repeated string members = 6;</code>
   *
   * @return A list containing the members.
   */
  public com.google.protobuf.ProtocolStringList getMembersList() {
    return members_;
  }
  /**
   *
   *
   * <pre>
   * The request must be made by one of the provided user or service
   * accounts. Groups are not supported.
   * Syntax:
   * `user:{emailid}`
   * `serviceAccount:{emailid}`
   * If not specified, a request may come from any user.
   * </pre>
   *
   * <code>repeated string members = 6;</code>
   *
   * @return The count of members.
   */
  public int getMembersCount() {
    return members_.size();
  }
  /**
   *
   *
   * <pre>
   * The request must be made by one of the provided user or service
   * accounts. Groups are not supported.
   * Syntax:
   * `user:{emailid}`
   * `serviceAccount:{emailid}`
   * If not specified, a request may come from any user.
   * </pre>
   *
   * <code>repeated string members = 6;</code>
   *
   * @param index The index of the element to return.
   * @return The members at the given index.
   */
  public java.lang.String getMembers(int index) {
    return members_.get(index);
  }
  /**
   *
   *
   * <pre>
   * The request must be made by one of the provided user or service
   * accounts. Groups are not supported.
   * Syntax:
   * `user:{emailid}`
   * `serviceAccount:{emailid}`
   * If not specified, a request may come from any user.
   * </pre>
   *
   * <code>repeated string members = 6;</code>
   *
   * @param index The index of the value to return.
   * @return The bytes of the members at the given index.
   */
  public com.google.protobuf.ByteString getMembersBytes(int index) {
    return members_.getByteString(index);
  }

  public static final int REGIONS_FIELD_NUMBER = 7;

  @SuppressWarnings("serial")
  private com.google.protobuf.LazyStringList regions_;
  /**
   *
   *
   * <pre>
   * The request must originate from one of the provided countries/regions.
   * Must be valid ISO 3166-1 alpha-2 codes.
   * </pre>
   *
   * <code>repeated string regions = 7;</code>
   *
   * @return A list containing the regions.
   */
  public com.google.protobuf.ProtocolStringList getRegionsList() {
    return regions_;
  }
  /**
   *
   *
   * <pre>
   * The request must originate from one of the provided countries/regions.
   * Must be valid ISO 3166-1 alpha-2 codes.
   * </pre>
   *
   * <code>repeated string regions = 7;</code>
   *
   * @return The count of regions.
   */
  public int getRegionsCount() {
    return regions_.size();
  }
  /**
   *
   *
   * <pre>
   * The request must originate from one of the provided countries/regions.
   * Must be valid ISO 3166-1 alpha-2 codes.
   * </pre>
   *
   * <code>repeated string regions = 7;</code>
   *
   * @param index The index of the element to return.
   * @return The regions at the given index.
   */
  public java.lang.String getRegions(int index) {
    return regions_.get(index);
  }
  /**
   *
   *
   * <pre>
   * The request must originate from one of the provided countries/regions.
   * Must be valid ISO 3166-1 alpha-2 codes.
   * </pre>
   *
   * <code>repeated string regions = 7;</code>
   *
   * @param index The index of the value to return.
   * @return The bytes of the regions at the given index.
   */
  public com.google.protobuf.ByteString getRegionsBytes(int index) {
    return regions_.getByteString(index);
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    for (int i = 0; i < ipSubnetworks_.size(); i++) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, ipSubnetworks_.getRaw(i));
    }
    if (devicePolicy_ != null) {
      output.writeMessage(2, getDevicePolicy());
    }
    for (int i = 0; i < requiredAccessLevels_.size(); i++) {
      com.google.protobuf.GeneratedMessageV3.writeString(
          output, 3, requiredAccessLevels_.getRaw(i));
    }
    if (negate_ != false) {
      output.writeBool(5, negate_);
    }
    for (int i = 0; i < members_.size(); i++) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 6, members_.getRaw(i));
    }
    for (int i = 0; i < regions_.size(); i++) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 7, regions_.getRaw(i));
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    {
      int dataSize = 0;
      for (int i = 0; i < ipSubnetworks_.size(); i++) {
        dataSize += computeStringSizeNoTag(ipSubnetworks_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getIpSubnetworksList().size();
    }
    if (devicePolicy_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDevicePolicy());
    }
    {
      int dataSize = 0;
      for (int i = 0; i < requiredAccessLevels_.size(); i++) {
        dataSize += computeStringSizeNoTag(requiredAccessLevels_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getRequiredAccessLevelsList().size();
    }
    if (negate_ != false) {
      size += com.google.protobuf.CodedOutputStream.computeBoolSize(5, negate_);
    }
    {
      int dataSize = 0;
      for (int i = 0; i < members_.size(); i++) {
        dataSize += computeStringSizeNoTag(members_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getMembersList().size();
    }
    {
      int dataSize = 0;
      for (int i = 0; i < regions_.size(); i++) {
        dataSize += computeStringSizeNoTag(regions_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getRegionsList().size();
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.identity.accesscontextmanager.v1.Condition)) {
      return super.equals(obj);
    }
    com.google.identity.accesscontextmanager.v1.Condition other =
        (com.google.identity.accesscontextmanager.v1.Condition) obj;

    if (!getIpSubnetworksList().equals(other.getIpSubnetworksList())) return false;
    if (hasDevicePolicy() != other.hasDevicePolicy()) return false;
    if (hasDevicePolicy()) {
      if (!getDevicePolicy().equals(other.getDevicePolicy())) return false;
    }
    if (!getRequiredAccessLevelsList().equals(other.getRequiredAccessLevelsList())) return false;
    if (getNegate() != other.getNegate()) return false;
    if (!getMembersList().equals(other.getMembersList())) return false;
    if (!getRegionsList().equals(other.getRegionsList())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (getIpSubnetworksCount() > 0) {
      hash = (37 * hash) + IP_SUBNETWORKS_FIELD_NUMBER;
      hash = (53 * hash) + getIpSubnetworksList().hashCode();
    }
    if (hasDevicePolicy()) {
      hash = (37 * hash) + DEVICE_POLICY_FIELD_NUMBER;
      hash = (53 * hash) + getDevicePolicy().hashCode();
    }
    if (getRequiredAccessLevelsCount() > 0) {
      hash = (37 * hash) + REQUIRED_ACCESS_LEVELS_FIELD_NUMBER;
      hash = (53 * hash) + getRequiredAccessLevelsList().hashCode();
    }
    hash = (37 * hash) + NEGATE_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getNegate());
    if (getMembersCount() > 0) {
      hash = (37 * hash) + MEMBERS_FIELD_NUMBER;
      hash = (53 * hash) + getMembersList().hashCode();
    }
    if (getRegionsCount() > 0) {
      hash = (37 * hash) + REGIONS_FIELD_NUMBER;
      hash = (53 * hash) + getRegionsList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.identity.accesscontextmanager.v1.Condition parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(
      com.google.identity.accesscontextmanager.v1.Condition prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   * <pre>
   * A condition necessary for an `AccessLevel` to be granted. The Condition is an
   * AND over its fields. So a Condition is true if: 1) the request IP is from one
   * of the listed subnetworks AND 2) the originating device complies with the
   * listed device policy AND 3) all listed access levels are granted AND 4) the
   * request was sent at a time allowed by the DateTimeRestriction.
   * </pre>
   *
   * Protobuf type {@code google.identity.accesscontextmanager.v1.Condition}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.identity.accesscontextmanager.v1.Condition)
      com.google.identity.accesscontextmanager.v1.ConditionOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.identity.accesscontextmanager.v1.AccessLevelProto
          .internal_static_google_identity_accesscontextmanager_v1_Condition_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.identity.accesscontextmanager.v1.AccessLevelProto
          .internal_static_google_identity_accesscontextmanager_v1_Condition_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.identity.accesscontextmanager.v1.Condition.class,
              com.google.identity.accesscontextmanager.v1.Condition.Builder.class);
    }

    // Construct using com.google.identity.accesscontextmanager.v1.Condition.newBuilder()
    private Builder() {}

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      ipSubnetworks_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000001);
      devicePolicy_ = null;
      if (devicePolicyBuilder_ != null) {
        devicePolicyBuilder_.dispose();
        devicePolicyBuilder_ = null;
      }
      requiredAccessLevels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000004);
      negate_ = false;
      members_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000010);
      regions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000020);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.identity.accesscontextmanager.v1.AccessLevelProto
          .internal_static_google_identity_accesscontextmanager_v1_Condition_descriptor;
    }

    @java.lang.Override
    public com.google.identity.accesscontextmanager.v1.Condition getDefaultInstanceForType() {
      return com.google.identity.accesscontextmanager.v1.Condition.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.identity.accesscontextmanager.v1.Condition build() {
      com.google.identity.accesscontextmanager.v1.Condition result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.identity.accesscontextmanager.v1.Condition buildPartial() {
      com.google.identity.accesscontextmanager.v1.Condition result =
          new com.google.identity.accesscontextmanager.v1.Condition(this);
      buildPartialRepeatedFields(result);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartialRepeatedFields(
        com.google.identity.accesscontextmanager.v1.Condition result) {
      if (((bitField0_ & 0x00000001) != 0)) {
        ipSubnetworks_ = ipSubnetworks_.getUnmodifiableView();
        bitField0_ = (bitField0_ & ~0x00000001);
      }
      result.ipSubnetworks_ = ipSubnetworks_;
      if (((bitField0_ & 0x00000004) != 0)) {
        requiredAccessLevels_ = requiredAccessLevels_.getUnmodifiableView();
        bitField0_ = (bitField0_ & ~0x00000004);
      }
      result.requiredAccessLevels_ = requiredAccessLevels_;
      if (((bitField0_ & 0x00000010) != 0)) {
        members_ = members_.getUnmodifiableView();
        bitField0_ = (bitField0_ & ~0x00000010);
      }
      result.members_ = members_;
      if (((bitField0_ & 0x00000020) != 0)) {
        regions_ = regions_.getUnmodifiableView();
        bitField0_ = (bitField0_ & ~0x00000020);
      }
      result.regions_ = regions_;
    }

    private void buildPartial0(com.google.identity.accesscontextmanager.v1.Condition result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.devicePolicy_ =
            devicePolicyBuilder_ == null ? devicePolicy_ : devicePolicyBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.negate_ = negate_;
      }
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.identity.accesscontextmanager.v1.Condition) {
        return mergeFrom((com.google.identity.accesscontextmanager.v1.Condition) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.identity.accesscontextmanager.v1.Condition other) {
      if (other == com.google.identity.accesscontextmanager.v1.Condition.getDefaultInstance())
        return this;
      if (!other.ipSubnetworks_.isEmpty()) {
        if (ipSubnetworks_.isEmpty()) {
          ipSubnetworks_ = other.ipSubnetworks_;
          bitField0_ = (bitField0_ & ~0x00000001);
        } else {
          ensureIpSubnetworksIsMutable();
          ipSubnetworks_.addAll(other.ipSubnetworks_);
        }
        onChanged();
      }
      if (other.hasDevicePolicy()) {
        mergeDevicePolicy(other.getDevicePolicy());
      }
      if (!other.requiredAccessLevels_.isEmpty()) {
        if (requiredAccessLevels_.isEmpty()) {
          requiredAccessLevels_ = other.requiredAccessLevels_;
          bitField0_ = (bitField0_ & ~0x00000004);
        } else {
          ensureRequiredAccessLevelsIsMutable();
          requiredAccessLevels_.addAll(other.requiredAccessLevels_);
        }
        onChanged();
      }
      if (other.getNegate() != false) {
        setNegate(other.getNegate());
      }
      if (!other.members_.isEmpty()) {
        if (members_.isEmpty()) {
          members_ = other.members_;
          bitField0_ = (bitField0_ & ~0x00000010);
        } else {
          ensureMembersIsMutable();
          members_.addAll(other.members_);
        }
        onChanged();
      }
      if (!other.regions_.isEmpty()) {
        if (regions_.isEmpty()) {
          regions_ = other.regions_;
          bitField0_ = (bitField0_ & ~0x00000020);
        } else {
          ensureRegionsIsMutable();
          regions_.addAll(other.regions_);
        }
        onChanged();
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                java.lang.String s = input.readStringRequireUtf8();
                ensureIpSubnetworksIsMutable();
                ipSubnetworks_.add(s);
                break;
              } // case 10
            case 18:
              {
                input.readMessage(getDevicePolicyFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 26:
              {
                java.lang.String s = input.readStringRequireUtf8();
                ensureRequiredAccessLevelsIsMutable();
                requiredAccessLevels_.add(s);
                break;
              } // case 26
            case 40:
              {
                negate_ = input.readBool();
                bitField0_ |= 0x00000008;
                break;
              } // case 40
            case 50:
              {
                java.lang.String s = input.readStringRequireUtf8();
                ensureMembersIsMutable();
                members_.add(s);
                break;
              } // case 50
            case 58:
              {
                java.lang.String s = input.readStringRequireUtf8();
                ensureRegionsIsMutable();
                regions_.add(s);
                break;
              } // case 58
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private com.google.protobuf.LazyStringList ipSubnetworks_ =
        com.google.protobuf.LazyStringArrayList.EMPTY;

    private void ensureIpSubnetworksIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        ipSubnetworks_ = new com.google.protobuf.LazyStringArrayList(ipSubnetworks_);
        bitField0_ |= 0x00000001;
      }
    }
    /**
     *
     *
     * <pre>
     * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
     * a CIDR IP address block, the specified IP address portion must be properly
     * truncated (i.e. all the host bits must be zero) or the input is considered
     * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
     * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
     * "2001:db8::1/32" is not. The originating IP of a request must be in one of
     * the listed subnets in order for this Condition to be true. If empty, all IP
     * addresses are allowed.
     * </pre>
     *
     * <code>repeated string ip_subnetworks = 1;</code>
     *
     * @return A list containing the ipSubnetworks.
     */
    public com.google.protobuf.ProtocolStringList getIpSubnetworksList() {
      return ipSubnetworks_.getUnmodifiableView();
    }
    /**
     *
     *
     * <pre>
     * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
     * a CIDR IP address block, the specified IP address portion must be properly
     * truncated (i.e. all the host bits must be zero) or the input is considered
     * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
     * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
     * "2001:db8::1/32" is not. The originating IP of a request must be in one of
     * the listed subnets in order for this Condition to be true. If empty, all IP
     * addresses are allowed.
     * </pre>
     *
     * <code>repeated string ip_subnetworks = 1;</code>
     *
     * @return The count of ipSubnetworks.
     */
    public int getIpSubnetworksCount() {
      return ipSubnetworks_.size();
    }
    /**
     *
     *
     * <pre>
     * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
     * a CIDR IP address block, the specified IP address portion must be properly
     * truncated (i.e. all the host bits must be zero) or the input is considered
     * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
     * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
     * "2001:db8::1/32" is not. The originating IP of a request must be in one of
     * the listed subnets in order for this Condition to be true. If empty, all IP
     * addresses are allowed.
     * </pre>
     *
     * <code>repeated string ip_subnetworks = 1;</code>
     *
     * @param index The index of the element to return.
     * @return The ipSubnetworks at the given index.
     */
    public java.lang.String getIpSubnetworks(int index) {
      return ipSubnetworks_.get(index);
    }
    /**
     *
     *
     * <pre>
     * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
     * a CIDR IP address block, the specified IP address portion must be properly
     * truncated (i.e. all the host bits must be zero) or the input is considered
     * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
     * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
     * "2001:db8::1/32" is not. The originating IP of a request must be in one of
     * the listed subnets in order for this Condition to be true. If empty, all IP
     * addresses are allowed.
     * </pre>
     *
     * <code>repeated string ip_subnetworks = 1;</code>
     *
     * @param index The index of the value to return.
     * @return The bytes of the ipSubnetworks at the given index.
     */
    public com.google.protobuf.ByteString getIpSubnetworksBytes(int index) {
      return ipSubnetworks_.getByteString(index);
    }
    /**
     *
     *
     * <pre>
     * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
     * a CIDR IP address block, the specified IP address portion must be properly
     * truncated (i.e. all the host bits must be zero) or the input is considered
     * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
     * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
     * "2001:db8::1/32" is not. The originating IP of a request must be in one of
     * the listed subnets in order for this Condition to be true. If empty, all IP
     * addresses are allowed.
     * </pre>
     *
     * <code>repeated string ip_subnetworks = 1;</code>
     *
     * @param index The index to set the value at.
     * @param value The ipSubnetworks to set.
     * @return This builder for chaining.
     */
    public Builder setIpSubnetworks(int index, java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureIpSubnetworksIsMutable();
      ipSubnetworks_.set(index, value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
     * a CIDR IP address block, the specified IP address portion must be properly
     * truncated (i.e. all the host bits must be zero) or the input is considered
     * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
     * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
     * "2001:db8::1/32" is not. The originating IP of a request must be in one of
     * the listed subnets in order for this Condition to be true. If empty, all IP
     * addresses are allowed.
     * </pre>
     *
     * <code>repeated string ip_subnetworks = 1;</code>
     *
     * @param value The ipSubnetworks to add.
     * @return This builder for chaining.
     */
    public Builder addIpSubnetworks(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureIpSubnetworksIsMutable();
      ipSubnetworks_.add(value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
     * a CIDR IP address block, the specified IP address portion must be properly
     * truncated (i.e. all the host bits must be zero) or the input is considered
     * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
     * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
     * "2001:db8::1/32" is not. The originating IP of a request must be in one of
     * the listed subnets in order for this Condition to be true. If empty, all IP
     * addresses are allowed.
     * </pre>
     *
     * <code>repeated string ip_subnetworks = 1;</code>
     *
     * @param values The ipSubnetworks to add.
     * @return This builder for chaining.
     */
    public Builder addAllIpSubnetworks(java.lang.Iterable<java.lang.String> values) {
      ensureIpSubnetworksIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(values, ipSubnetworks_);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
     * a CIDR IP address block, the specified IP address portion must be properly
     * truncated (i.e. all the host bits must be zero) or the input is considered
     * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
     * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
     * "2001:db8::1/32" is not. The originating IP of a request must be in one of
     * the listed subnets in order for this Condition to be true. If empty, all IP
     * addresses are allowed.
     * </pre>
     *
     * <code>repeated string ip_subnetworks = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearIpSubnetworks() {
      ipSubnetworks_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
     * a CIDR IP address block, the specified IP address portion must be properly
     * truncated (i.e. all the host bits must be zero) or the input is considered
     * malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
     * not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
     * "2001:db8::1/32" is not. The originating IP of a request must be in one of
     * the listed subnets in order for this Condition to be true. If empty, all IP
     * addresses are allowed.
     * </pre>
     *
     * <code>repeated string ip_subnetworks = 1;</code>
     *
     * @param value The bytes of the ipSubnetworks to add.
     * @return This builder for chaining.
     */
    public Builder addIpSubnetworksBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      ensureIpSubnetworksIsMutable();
      ipSubnetworks_.add(value);
      onChanged();
      return this;
    }

    private com.google.identity.accesscontextmanager.v1.DevicePolicy devicePolicy_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.identity.accesscontextmanager.v1.DevicePolicy,
            com.google.identity.accesscontextmanager.v1.DevicePolicy.Builder,
            com.google.identity.accesscontextmanager.v1.DevicePolicyOrBuilder>
        devicePolicyBuilder_;
    /**
     *
     *
     * <pre>
     * Device specific restrictions, all restrictions must hold for the
     * Condition to be true. If not specified, all devices are allowed.
     * </pre>
     *
     * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
     *
     * @return Whether the devicePolicy field is set.
     */
    public boolean hasDevicePolicy() {
      return ((bitField0_ & 0x00000002) != 0);
    }
    /**
     *
     *
     * <pre>
     * Device specific restrictions, all restrictions must hold for the
     * Condition to be true. If not specified, all devices are allowed.
     * </pre>
     *
     * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
     *
     * @return The devicePolicy.
     */
    public com.google.identity.accesscontextmanager.v1.DevicePolicy getDevicePolicy() {
      if (devicePolicyBuilder_ == null) {
        return devicePolicy_ == null
            ? com.google.identity.accesscontextmanager.v1.DevicePolicy.getDefaultInstance()
            : devicePolicy_;
      } else {
        return devicePolicyBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Device specific restrictions, all restrictions must hold for the
     * Condition to be true. If not specified, all devices are allowed.
     * </pre>
     *
     * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
     */
    public Builder setDevicePolicy(com.google.identity.accesscontextmanager.v1.DevicePolicy value) {
      if (devicePolicyBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        devicePolicy_ = value;
      } else {
        devicePolicyBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Device specific restrictions, all restrictions must hold for the
     * Condition to be true. If not specified, all devices are allowed.
     * </pre>
     *
     * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
     */
    public Builder setDevicePolicy(
        com.google.identity.accesscontextmanager.v1.DevicePolicy.Builder builderForValue) {
      if (devicePolicyBuilder_ == null) {
        devicePolicy_ = builderForValue.build();
      } else {
        devicePolicyBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Device specific restrictions, all restrictions must hold for the
     * Condition to be true. If not specified, all devices are allowed.
     * </pre>
     *
     * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
     */
    public Builder mergeDevicePolicy(
        com.google.identity.accesscontextmanager.v1.DevicePolicy value) {
      if (devicePolicyBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)
            && devicePolicy_ != null
            && devicePolicy_
                != com.google.identity.accesscontextmanager.v1.DevicePolicy.getDefaultInstance()) {
          getDevicePolicyBuilder().mergeFrom(value);
        } else {
          devicePolicy_ = value;
        }
      } else {
        devicePolicyBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Device specific restrictions, all restrictions must hold for the
     * Condition to be true. If not specified, all devices are allowed.
     * </pre>
     *
     * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
     */
    public Builder clearDevicePolicy() {
      bitField0_ = (bitField0_ & ~0x00000002);
      devicePolicy_ = null;
      if (devicePolicyBuilder_ != null) {
        devicePolicyBuilder_.dispose();
        devicePolicyBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Device specific restrictions, all restrictions must hold for the
     * Condition to be true. If not specified, all devices are allowed.
     * </pre>
     *
     * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
     */
    public com.google.identity.accesscontextmanager.v1.DevicePolicy.Builder
        getDevicePolicyBuilder() {
      bitField0_ |= 0x00000002;
      onChanged();
      return getDevicePolicyFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Device specific restrictions, all restrictions must hold for the
     * Condition to be true. If not specified, all devices are allowed.
     * </pre>
     *
     * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
     */
    public com.google.identity.accesscontextmanager.v1.DevicePolicyOrBuilder
        getDevicePolicyOrBuilder() {
      if (devicePolicyBuilder_ != null) {
        return devicePolicyBuilder_.getMessageOrBuilder();
      } else {
        return devicePolicy_ == null
            ? com.google.identity.accesscontextmanager.v1.DevicePolicy.getDefaultInstance()
            : devicePolicy_;
      }
    }
    /**
     *
     *
     * <pre>
     * Device specific restrictions, all restrictions must hold for the
     * Condition to be true. If not specified, all devices are allowed.
     * </pre>
     *
     * <code>.google.identity.accesscontextmanager.v1.DevicePolicy device_policy = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.identity.accesscontextmanager.v1.DevicePolicy,
            com.google.identity.accesscontextmanager.v1.DevicePolicy.Builder,
            com.google.identity.accesscontextmanager.v1.DevicePolicyOrBuilder>
        getDevicePolicyFieldBuilder() {
      if (devicePolicyBuilder_ == null) {
        devicePolicyBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.identity.accesscontextmanager.v1.DevicePolicy,
                com.google.identity.accesscontextmanager.v1.DevicePolicy.Builder,
                com.google.identity.accesscontextmanager.v1.DevicePolicyOrBuilder>(
                getDevicePolicy(), getParentForChildren(), isClean());
        devicePolicy_ = null;
      }
      return devicePolicyBuilder_;
    }

    private com.google.protobuf.LazyStringList requiredAccessLevels_ =
        com.google.protobuf.LazyStringArrayList.EMPTY;

    private void ensureRequiredAccessLevelsIsMutable() {
      if (!((bitField0_ & 0x00000004) != 0)) {
        requiredAccessLevels_ = new com.google.protobuf.LazyStringArrayList(requiredAccessLevels_);
        bitField0_ |= 0x00000004;
      }
    }
    /**
     *
     *
     * <pre>
     * A list of other access levels defined in the same `Policy`, referenced by
     * resource name. Referencing an `AccessLevel` which does not exist is an
     * error. All access levels listed must be granted for the Condition
     * to be true. Example:
     * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
     * </pre>
     *
     * <code>repeated string required_access_levels = 3;</code>
     *
     * @return A list containing the requiredAccessLevels.
     */
    public com.google.protobuf.ProtocolStringList getRequiredAccessLevelsList() {
      return requiredAccessLevels_.getUnmodifiableView();
    }
    /**
     *
     *
     * <pre>
     * A list of other access levels defined in the same `Policy`, referenced by
     * resource name. Referencing an `AccessLevel` which does not exist is an
     * error. All access levels listed must be granted for the Condition
     * to be true. Example:
     * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
     * </pre>
     *
     * <code>repeated string required_access_levels = 3;</code>
     *
     * @return The count of requiredAccessLevels.
     */
    public int getRequiredAccessLevelsCount() {
      return requiredAccessLevels_.size();
    }
    /**
     *
     *
     * <pre>
     * A list of other access levels defined in the same `Policy`, referenced by
     * resource name. Referencing an `AccessLevel` which does not exist is an
     * error. All access levels listed must be granted for the Condition
     * to be true. Example:
     * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
     * </pre>
     *
     * <code>repeated string required_access_levels = 3;</code>
     *
     * @param index The index of the element to return.
     * @return The requiredAccessLevels at the given index.
     */
    public java.lang.String getRequiredAccessLevels(int index) {
      return requiredAccessLevels_.get(index);
    }
    /**
     *
     *
     * <pre>
     * A list of other access levels defined in the same `Policy`, referenced by
     * resource name. Referencing an `AccessLevel` which does not exist is an
     * error. All access levels listed must be granted for the Condition
     * to be true. Example:
     * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
     * </pre>
     *
     * <code>repeated string required_access_levels = 3;</code>
     *
     * @param index The index of the value to return.
     * @return The bytes of the requiredAccessLevels at the given index.
     */
    public com.google.protobuf.ByteString getRequiredAccessLevelsBytes(int index) {
      return requiredAccessLevels_.getByteString(index);
    }
    /**
     *
     *
     * <pre>
     * A list of other access levels defined in the same `Policy`, referenced by
     * resource name. Referencing an `AccessLevel` which does not exist is an
     * error. All access levels listed must be granted for the Condition
     * to be true. Example:
     * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
     * </pre>
     *
     * <code>repeated string required_access_levels = 3;</code>
     *
     * @param index The index to set the value at.
     * @param value The requiredAccessLevels to set.
     * @return This builder for chaining.
     */
    public Builder setRequiredAccessLevels(int index, java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureRequiredAccessLevelsIsMutable();
      requiredAccessLevels_.set(index, value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of other access levels defined in the same `Policy`, referenced by
     * resource name. Referencing an `AccessLevel` which does not exist is an
     * error. All access levels listed must be granted for the Condition
     * to be true. Example:
     * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
     * </pre>
     *
     * <code>repeated string required_access_levels = 3;</code>
     *
     * @param value The requiredAccessLevels to add.
     * @return This builder for chaining.
     */
    public Builder addRequiredAccessLevels(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureRequiredAccessLevelsIsMutable();
      requiredAccessLevels_.add(value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of other access levels defined in the same `Policy`, referenced by
     * resource name. Referencing an `AccessLevel` which does not exist is an
     * error. All access levels listed must be granted for the Condition
     * to be true. Example:
     * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
     * </pre>
     *
     * <code>repeated string required_access_levels = 3;</code>
     *
     * @param values The requiredAccessLevels to add.
     * @return This builder for chaining.
     */
    public Builder addAllRequiredAccessLevels(java.lang.Iterable<java.lang.String> values) {
      ensureRequiredAccessLevelsIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(values, requiredAccessLevels_);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of other access levels defined in the same `Policy`, referenced by
     * resource name. Referencing an `AccessLevel` which does not exist is an
     * error. All access levels listed must be granted for the Condition
     * to be true. Example:
     * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
     * </pre>
     *
     * <code>repeated string required_access_levels = 3;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearRequiredAccessLevels() {
      requiredAccessLevels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000004);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of other access levels defined in the same `Policy`, referenced by
     * resource name. Referencing an `AccessLevel` which does not exist is an
     * error. All access levels listed must be granted for the Condition
     * to be true. Example:
     * "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
     * </pre>
     *
     * <code>repeated string required_access_levels = 3;</code>
     *
     * @param value The bytes of the requiredAccessLevels to add.
     * @return This builder for chaining.
     */
    public Builder addRequiredAccessLevelsBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      ensureRequiredAccessLevelsIsMutable();
      requiredAccessLevels_.add(value);
      onChanged();
      return this;
    }

    private boolean negate_;
    /**
     *
     *
     * <pre>
     * Whether to negate the Condition. If true, the Condition becomes a NAND over
     * its non-empty fields, each field must be false for the Condition overall to
     * be satisfied. Defaults to false.
     * </pre>
     *
     * <code>bool negate = 5;</code>
     *
     * @return The negate.
     */
    @java.lang.Override
    public boolean getNegate() {
      return negate_;
    }
    /**
     *
     *
     * <pre>
     * Whether to negate the Condition. If true, the Condition becomes a NAND over
     * its non-empty fields, each field must be false for the Condition overall to
     * be satisfied. Defaults to false.
     * </pre>
     *
     * <code>bool negate = 5;</code>
     *
     * @param value The negate to set.
     * @return This builder for chaining.
     */
    public Builder setNegate(boolean value) {

      negate_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Whether to negate the Condition. If true, the Condition becomes a NAND over
     * its non-empty fields, each field must be false for the Condition overall to
     * be satisfied. Defaults to false.
     * </pre>
     *
     * <code>bool negate = 5;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearNegate() {
      bitField0_ = (bitField0_ & ~0x00000008);
      negate_ = false;
      onChanged();
      return this;
    }

    private com.google.protobuf.LazyStringList members_ =
        com.google.protobuf.LazyStringArrayList.EMPTY;

    private void ensureMembersIsMutable() {
      if (!((bitField0_ & 0x00000010) != 0)) {
        members_ = new com.google.protobuf.LazyStringArrayList(members_);
        bitField0_ |= 0x00000010;
      }
    }
    /**
     *
     *
     * <pre>
     * The request must be made by one of the provided user or service
     * accounts. Groups are not supported.
     * Syntax:
     * `user:{emailid}`
     * `serviceAccount:{emailid}`
     * If not specified, a request may come from any user.
     * </pre>
     *
     * <code>repeated string members = 6;</code>
     *
     * @return A list containing the members.
     */
    public com.google.protobuf.ProtocolStringList getMembersList() {
      return members_.getUnmodifiableView();
    }
    /**
     *
     *
     * <pre>
     * The request must be made by one of the provided user or service
     * accounts. Groups are not supported.
     * Syntax:
     * `user:{emailid}`
     * `serviceAccount:{emailid}`
     * If not specified, a request may come from any user.
     * </pre>
     *
     * <code>repeated string members = 6;</code>
     *
     * @return The count of members.
     */
    public int getMembersCount() {
      return members_.size();
    }
    /**
     *
     *
     * <pre>
     * The request must be made by one of the provided user or service
     * accounts. Groups are not supported.
     * Syntax:
     * `user:{emailid}`
     * `serviceAccount:{emailid}`
     * If not specified, a request may come from any user.
     * </pre>
     *
     * <code>repeated string members = 6;</code>
     *
     * @param index The index of the element to return.
     * @return The members at the given index.
     */
    public java.lang.String getMembers(int index) {
      return members_.get(index);
    }
    /**
     *
     *
     * <pre>
     * The request must be made by one of the provided user or service
     * accounts. Groups are not supported.
     * Syntax:
     * `user:{emailid}`
     * `serviceAccount:{emailid}`
     * If not specified, a request may come from any user.
     * </pre>
     *
     * <code>repeated string members = 6;</code>
     *
     * @param index The index of the value to return.
     * @return The bytes of the members at the given index.
     */
    public com.google.protobuf.ByteString getMembersBytes(int index) {
      return members_.getByteString(index);
    }
    /**
     *
     *
     * <pre>
     * The request must be made by one of the provided user or service
     * accounts. Groups are not supported.
     * Syntax:
     * `user:{emailid}`
     * `serviceAccount:{emailid}`
     * If not specified, a request may come from any user.
     * </pre>
     *
     * <code>repeated string members = 6;</code>
     *
     * @param index The index to set the value at.
     * @param value The members to set.
     * @return This builder for chaining.
     */
    public Builder setMembers(int index, java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureMembersIsMutable();
      members_.set(index, value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The request must be made by one of the provided user or service
     * accounts. Groups are not supported.
     * Syntax:
     * `user:{emailid}`
     * `serviceAccount:{emailid}`
     * If not specified, a request may come from any user.
     * </pre>
     *
     * <code>repeated string members = 6;</code>
     *
     * @param value The members to add.
     * @return This builder for chaining.
     */
    public Builder addMembers(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureMembersIsMutable();
      members_.add(value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The request must be made by one of the provided user or service
     * accounts. Groups are not supported.
     * Syntax:
     * `user:{emailid}`
     * `serviceAccount:{emailid}`
     * If not specified, a request may come from any user.
     * </pre>
     *
     * <code>repeated string members = 6;</code>
     *
     * @param values The members to add.
     * @return This builder for chaining.
     */
    public Builder addAllMembers(java.lang.Iterable<java.lang.String> values) {
      ensureMembersIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(values, members_);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The request must be made by one of the provided user or service
     * accounts. Groups are not supported.
     * Syntax:
     * `user:{emailid}`
     * `serviceAccount:{emailid}`
     * If not specified, a request may come from any user.
     * </pre>
     *
     * <code>repeated string members = 6;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearMembers() {
      members_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000010);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The request must be made by one of the provided user or service
     * accounts. Groups are not supported.
     * Syntax:
     * `user:{emailid}`
     * `serviceAccount:{emailid}`
     * If not specified, a request may come from any user.
     * </pre>
     *
     * <code>repeated string members = 6;</code>
     *
     * @param value The bytes of the members to add.
     * @return This builder for chaining.
     */
    public Builder addMembersBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      ensureMembersIsMutable();
      members_.add(value);
      onChanged();
      return this;
    }

    private com.google.protobuf.LazyStringList regions_ =
        com.google.protobuf.LazyStringArrayList.EMPTY;

    private void ensureRegionsIsMutable() {
      if (!((bitField0_ & 0x00000020) != 0)) {
        regions_ = new com.google.protobuf.LazyStringArrayList(regions_);
        bitField0_ |= 0x00000020;
      }
    }
    /**
     *
     *
     * <pre>
     * The request must originate from one of the provided countries/regions.
     * Must be valid ISO 3166-1 alpha-2 codes.
     * </pre>
     *
     * <code>repeated string regions = 7;</code>
     *
     * @return A list containing the regions.
     */
    public com.google.protobuf.ProtocolStringList getRegionsList() {
      return regions_.getUnmodifiableView();
    }
    /**
     *
     *
     * <pre>
     * The request must originate from one of the provided countries/regions.
     * Must be valid ISO 3166-1 alpha-2 codes.
     * </pre>
     *
     * <code>repeated string regions = 7;</code>
     *
     * @return The count of regions.
     */
    public int getRegionsCount() {
      return regions_.size();
    }
    /**
     *
     *
     * <pre>
     * The request must originate from one of the provided countries/regions.
     * Must be valid ISO 3166-1 alpha-2 codes.
     * </pre>
     *
     * <code>repeated string regions = 7;</code>
     *
     * @param index The index of the element to return.
     * @return The regions at the given index.
     */
    public java.lang.String getRegions(int index) {
      return regions_.get(index);
    }
    /**
     *
     *
     * <pre>
     * The request must originate from one of the provided countries/regions.
     * Must be valid ISO 3166-1 alpha-2 codes.
     * </pre>
     *
     * <code>repeated string regions = 7;</code>
     *
     * @param index The index of the value to return.
     * @return The bytes of the regions at the given index.
     */
    public com.google.protobuf.ByteString getRegionsBytes(int index) {
      return regions_.getByteString(index);
    }
    /**
     *
     *
     * <pre>
     * The request must originate from one of the provided countries/regions.
     * Must be valid ISO 3166-1 alpha-2 codes.
     * </pre>
     *
     * <code>repeated string regions = 7;</code>
     *
     * @param index The index to set the value at.
     * @param value The regions to set.
     * @return This builder for chaining.
     */
    public Builder setRegions(int index, java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureRegionsIsMutable();
      regions_.set(index, value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The request must originate from one of the provided countries/regions.
     * Must be valid ISO 3166-1 alpha-2 codes.
     * </pre>
     *
     * <code>repeated string regions = 7;</code>
     *
     * @param value The regions to add.
     * @return This builder for chaining.
     */
    public Builder addRegions(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureRegionsIsMutable();
      regions_.add(value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The request must originate from one of the provided countries/regions.
     * Must be valid ISO 3166-1 alpha-2 codes.
     * </pre>
     *
     * <code>repeated string regions = 7;</code>
     *
     * @param values The regions to add.
     * @return This builder for chaining.
     */
    public Builder addAllRegions(java.lang.Iterable<java.lang.String> values) {
      ensureRegionsIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(values, regions_);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The request must originate from one of the provided countries/regions.
     * Must be valid ISO 3166-1 alpha-2 codes.
     * </pre>
     *
     * <code>repeated string regions = 7;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearRegions() {
      regions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000020);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The request must originate from one of the provided countries/regions.
     * Must be valid ISO 3166-1 alpha-2 codes.
     * </pre>
     *
     * <code>repeated string regions = 7;</code>
     *
     * @param value The bytes of the regions to add.
     * @return This builder for chaining.
     */
    public Builder addRegionsBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      ensureRegionsIsMutable();
      regions_.add(value);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.identity.accesscontextmanager.v1.Condition)
  }

  // @@protoc_insertion_point(class_scope:google.identity.accesscontextmanager.v1.Condition)
  private static final com.google.identity.accesscontextmanager.v1.Condition DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.identity.accesscontextmanager.v1.Condition();
  }

  public static com.google.identity.accesscontextmanager.v1.Condition getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<Condition> PARSER =
      new com.google.protobuf.AbstractParser<Condition>() {
        @java.lang.Override
        public Condition parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<Condition> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<Condition> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.identity.accesscontextmanager.v1.Condition getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
