/*
 * 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/cloud/channel/v1/offers.proto

package com.google.cloud.channel.v1;

/**
 *
 *
 * <pre>
 * Represents the price of the Offer.
 * </pre>
 *
 * Protobuf type {@code google.cloud.channel.v1.Price}
 */
public final class Price extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.channel.v1.Price)
    PriceOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use Price.newBuilder() to construct.
  private Price(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private Price() {
    externalPriceUri_ = "";
  }

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

  @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.cloud.channel.v1.OffersProto
        .internal_static_google_cloud_channel_v1_Price_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.channel.v1.OffersProto
        .internal_static_google_cloud_channel_v1_Price_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.channel.v1.Price.class,
            com.google.cloud.channel.v1.Price.Builder.class);
  }

  public static final int BASE_PRICE_FIELD_NUMBER = 1;
  private com.google.type.Money basePrice_;
  /**
   *
   *
   * <pre>
   * Base price.
   * </pre>
   *
   * <code>.google.type.Money base_price = 1;</code>
   *
   * @return Whether the basePrice field is set.
   */
  @java.lang.Override
  public boolean hasBasePrice() {
    return basePrice_ != null;
  }
  /**
   *
   *
   * <pre>
   * Base price.
   * </pre>
   *
   * <code>.google.type.Money base_price = 1;</code>
   *
   * @return The basePrice.
   */
  @java.lang.Override
  public com.google.type.Money getBasePrice() {
    return basePrice_ == null ? com.google.type.Money.getDefaultInstance() : basePrice_;
  }
  /**
   *
   *
   * <pre>
   * Base price.
   * </pre>
   *
   * <code>.google.type.Money base_price = 1;</code>
   */
  @java.lang.Override
  public com.google.type.MoneyOrBuilder getBasePriceOrBuilder() {
    return basePrice_ == null ? com.google.type.Money.getDefaultInstance() : basePrice_;
  }

  public static final int DISCOUNT_FIELD_NUMBER = 2;
  private double discount_ = 0D;
  /**
   *
   *
   * <pre>
   * Discount percentage, represented as decimal.
   * For example, a 20% discount will be represent as 0.2.
   * </pre>
   *
   * <code>double discount = 2;</code>
   *
   * @return The discount.
   */
  @java.lang.Override
  public double getDiscount() {
    return discount_;
  }

  public static final int EFFECTIVE_PRICE_FIELD_NUMBER = 3;
  private com.google.type.Money effectivePrice_;
  /**
   *
   *
   * <pre>
   * Effective Price after applying the discounts.
   * </pre>
   *
   * <code>.google.type.Money effective_price = 3;</code>
   *
   * @return Whether the effectivePrice field is set.
   */
  @java.lang.Override
  public boolean hasEffectivePrice() {
    return effectivePrice_ != null;
  }
  /**
   *
   *
   * <pre>
   * Effective Price after applying the discounts.
   * </pre>
   *
   * <code>.google.type.Money effective_price = 3;</code>
   *
   * @return The effectivePrice.
   */
  @java.lang.Override
  public com.google.type.Money getEffectivePrice() {
    return effectivePrice_ == null ? com.google.type.Money.getDefaultInstance() : effectivePrice_;
  }
  /**
   *
   *
   * <pre>
   * Effective Price after applying the discounts.
   * </pre>
   *
   * <code>.google.type.Money effective_price = 3;</code>
   */
  @java.lang.Override
  public com.google.type.MoneyOrBuilder getEffectivePriceOrBuilder() {
    return effectivePrice_ == null ? com.google.type.Money.getDefaultInstance() : effectivePrice_;
  }

  public static final int EXTERNAL_PRICE_URI_FIELD_NUMBER = 4;

  @SuppressWarnings("serial")
  private volatile java.lang.Object externalPriceUri_ = "";
  /**
   *
   *
   * <pre>
   * Link to external price list, such as link to Google Voice rate card.
   * </pre>
   *
   * <code>string external_price_uri = 4;</code>
   *
   * @return The externalPriceUri.
   */
  @java.lang.Override
  public java.lang.String getExternalPriceUri() {
    java.lang.Object ref = externalPriceUri_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      externalPriceUri_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Link to external price list, such as link to Google Voice rate card.
   * </pre>
   *
   * <code>string external_price_uri = 4;</code>
   *
   * @return The bytes for externalPriceUri.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getExternalPriceUriBytes() {
    java.lang.Object ref = externalPriceUri_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      externalPriceUri_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  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 {
    if (basePrice_ != null) {
      output.writeMessage(1, getBasePrice());
    }
    if (java.lang.Double.doubleToRawLongBits(discount_) != 0) {
      output.writeDouble(2, discount_);
    }
    if (effectivePrice_ != null) {
      output.writeMessage(3, getEffectivePrice());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(externalPriceUri_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, externalPriceUri_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (basePrice_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getBasePrice());
    }
    if (java.lang.Double.doubleToRawLongBits(discount_) != 0) {
      size += com.google.protobuf.CodedOutputStream.computeDoubleSize(2, discount_);
    }
    if (effectivePrice_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getEffectivePrice());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(externalPriceUri_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, externalPriceUri_);
    }
    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.cloud.channel.v1.Price)) {
      return super.equals(obj);
    }
    com.google.cloud.channel.v1.Price other = (com.google.cloud.channel.v1.Price) obj;

    if (hasBasePrice() != other.hasBasePrice()) return false;
    if (hasBasePrice()) {
      if (!getBasePrice().equals(other.getBasePrice())) return false;
    }
    if (java.lang.Double.doubleToLongBits(getDiscount())
        != java.lang.Double.doubleToLongBits(other.getDiscount())) return false;
    if (hasEffectivePrice() != other.hasEffectivePrice()) return false;
    if (hasEffectivePrice()) {
      if (!getEffectivePrice().equals(other.getEffectivePrice())) return false;
    }
    if (!getExternalPriceUri().equals(other.getExternalPriceUri())) 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 (hasBasePrice()) {
      hash = (37 * hash) + BASE_PRICE_FIELD_NUMBER;
      hash = (53 * hash) + getBasePrice().hashCode();
    }
    hash = (37 * hash) + DISCOUNT_FIELD_NUMBER;
    hash =
        (53 * hash)
            + com.google.protobuf.Internal.hashLong(
                java.lang.Double.doubleToLongBits(getDiscount()));
    if (hasEffectivePrice()) {
      hash = (37 * hash) + EFFECTIVE_PRICE_FIELD_NUMBER;
      hash = (53 * hash) + getEffectivePrice().hashCode();
    }
    hash = (37 * hash) + EXTERNAL_PRICE_URI_FIELD_NUMBER;
    hash = (53 * hash) + getExternalPriceUri().hashCode();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.channel.v1.Price parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

  public static com.google.cloud.channel.v1.Price parseFrom(com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.channel.v1.Price 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.cloud.channel.v1.Price parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

  public static com.google.cloud.channel.v1.Price 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.cloud.channel.v1.Price parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.channel.v1.Price 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.cloud.channel.v1.Price parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.channel.v1.Price 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.cloud.channel.v1.Price 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>
   * Represents the price of the Offer.
   * </pre>
   *
   * Protobuf type {@code google.cloud.channel.v1.Price}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.channel.v1.Price)
      com.google.cloud.channel.v1.PriceOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.channel.v1.OffersProto
          .internal_static_google_cloud_channel_v1_Price_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.channel.v1.OffersProto
          .internal_static_google_cloud_channel_v1_Price_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.channel.v1.Price.class,
              com.google.cloud.channel.v1.Price.Builder.class);
    }

    // Construct using com.google.cloud.channel.v1.Price.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      basePrice_ = null;
      if (basePriceBuilder_ != null) {
        basePriceBuilder_.dispose();
        basePriceBuilder_ = null;
      }
      discount_ = 0D;
      effectivePrice_ = null;
      if (effectivePriceBuilder_ != null) {
        effectivePriceBuilder_.dispose();
        effectivePriceBuilder_ = null;
      }
      externalPriceUri_ = "";
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.channel.v1.OffersProto
          .internal_static_google_cloud_channel_v1_Price_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.channel.v1.Price getDefaultInstanceForType() {
      return com.google.cloud.channel.v1.Price.getDefaultInstance();
    }

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

    @java.lang.Override
    public com.google.cloud.channel.v1.Price buildPartial() {
      com.google.cloud.channel.v1.Price result = new com.google.cloud.channel.v1.Price(this);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartial0(com.google.cloud.channel.v1.Price result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.basePrice_ = basePriceBuilder_ == null ? basePrice_ : basePriceBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.discount_ = discount_;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.effectivePrice_ =
            effectivePriceBuilder_ == null ? effectivePrice_ : effectivePriceBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.externalPriceUri_ = externalPriceUri_;
      }
    }

    @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.cloud.channel.v1.Price) {
        return mergeFrom((com.google.cloud.channel.v1.Price) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.channel.v1.Price other) {
      if (other == com.google.cloud.channel.v1.Price.getDefaultInstance()) return this;
      if (other.hasBasePrice()) {
        mergeBasePrice(other.getBasePrice());
      }
      if (other.getDiscount() != 0D) {
        setDiscount(other.getDiscount());
      }
      if (other.hasEffectivePrice()) {
        mergeEffectivePrice(other.getEffectivePrice());
      }
      if (!other.getExternalPriceUri().isEmpty()) {
        externalPriceUri_ = other.externalPriceUri_;
        bitField0_ |= 0x00000008;
        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:
              {
                input.readMessage(getBasePriceFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 17:
              {
                discount_ = input.readDouble();
                bitField0_ |= 0x00000002;
                break;
              } // case 17
            case 26:
              {
                input.readMessage(getEffectivePriceFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000004;
                break;
              } // case 26
            case 34:
              {
                externalPriceUri_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000008;
                break;
              } // case 34
            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.type.Money basePrice_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder>
        basePriceBuilder_;
    /**
     *
     *
     * <pre>
     * Base price.
     * </pre>
     *
     * <code>.google.type.Money base_price = 1;</code>
     *
     * @return Whether the basePrice field is set.
     */
    public boolean hasBasePrice() {
      return ((bitField0_ & 0x00000001) != 0);
    }
    /**
     *
     *
     * <pre>
     * Base price.
     * </pre>
     *
     * <code>.google.type.Money base_price = 1;</code>
     *
     * @return The basePrice.
     */
    public com.google.type.Money getBasePrice() {
      if (basePriceBuilder_ == null) {
        return basePrice_ == null ? com.google.type.Money.getDefaultInstance() : basePrice_;
      } else {
        return basePriceBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Base price.
     * </pre>
     *
     * <code>.google.type.Money base_price = 1;</code>
     */
    public Builder setBasePrice(com.google.type.Money value) {
      if (basePriceBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        basePrice_ = value;
      } else {
        basePriceBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Base price.
     * </pre>
     *
     * <code>.google.type.Money base_price = 1;</code>
     */
    public Builder setBasePrice(com.google.type.Money.Builder builderForValue) {
      if (basePriceBuilder_ == null) {
        basePrice_ = builderForValue.build();
      } else {
        basePriceBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Base price.
     * </pre>
     *
     * <code>.google.type.Money base_price = 1;</code>
     */
    public Builder mergeBasePrice(com.google.type.Money value) {
      if (basePriceBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)
            && basePrice_ != null
            && basePrice_ != com.google.type.Money.getDefaultInstance()) {
          getBasePriceBuilder().mergeFrom(value);
        } else {
          basePrice_ = value;
        }
      } else {
        basePriceBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Base price.
     * </pre>
     *
     * <code>.google.type.Money base_price = 1;</code>
     */
    public Builder clearBasePrice() {
      bitField0_ = (bitField0_ & ~0x00000001);
      basePrice_ = null;
      if (basePriceBuilder_ != null) {
        basePriceBuilder_.dispose();
        basePriceBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Base price.
     * </pre>
     *
     * <code>.google.type.Money base_price = 1;</code>
     */
    public com.google.type.Money.Builder getBasePriceBuilder() {
      bitField0_ |= 0x00000001;
      onChanged();
      return getBasePriceFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Base price.
     * </pre>
     *
     * <code>.google.type.Money base_price = 1;</code>
     */
    public com.google.type.MoneyOrBuilder getBasePriceOrBuilder() {
      if (basePriceBuilder_ != null) {
        return basePriceBuilder_.getMessageOrBuilder();
      } else {
        return basePrice_ == null ? com.google.type.Money.getDefaultInstance() : basePrice_;
      }
    }
    /**
     *
     *
     * <pre>
     * Base price.
     * </pre>
     *
     * <code>.google.type.Money base_price = 1;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder>
        getBasePriceFieldBuilder() {
      if (basePriceBuilder_ == null) {
        basePriceBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.type.Money,
                com.google.type.Money.Builder,
                com.google.type.MoneyOrBuilder>(getBasePrice(), getParentForChildren(), isClean());
        basePrice_ = null;
      }
      return basePriceBuilder_;
    }

    private double discount_;
    /**
     *
     *
     * <pre>
     * Discount percentage, represented as decimal.
     * For example, a 20% discount will be represent as 0.2.
     * </pre>
     *
     * <code>double discount = 2;</code>
     *
     * @return The discount.
     */
    @java.lang.Override
    public double getDiscount() {
      return discount_;
    }
    /**
     *
     *
     * <pre>
     * Discount percentage, represented as decimal.
     * For example, a 20% discount will be represent as 0.2.
     * </pre>
     *
     * <code>double discount = 2;</code>
     *
     * @param value The discount to set.
     * @return This builder for chaining.
     */
    public Builder setDiscount(double value) {

      discount_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Discount percentage, represented as decimal.
     * For example, a 20% discount will be represent as 0.2.
     * </pre>
     *
     * <code>double discount = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearDiscount() {
      bitField0_ = (bitField0_ & ~0x00000002);
      discount_ = 0D;
      onChanged();
      return this;
    }

    private com.google.type.Money effectivePrice_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder>
        effectivePriceBuilder_;
    /**
     *
     *
     * <pre>
     * Effective Price after applying the discounts.
     * </pre>
     *
     * <code>.google.type.Money effective_price = 3;</code>
     *
     * @return Whether the effectivePrice field is set.
     */
    public boolean hasEffectivePrice() {
      return ((bitField0_ & 0x00000004) != 0);
    }
    /**
     *
     *
     * <pre>
     * Effective Price after applying the discounts.
     * </pre>
     *
     * <code>.google.type.Money effective_price = 3;</code>
     *
     * @return The effectivePrice.
     */
    public com.google.type.Money getEffectivePrice() {
      if (effectivePriceBuilder_ == null) {
        return effectivePrice_ == null
            ? com.google.type.Money.getDefaultInstance()
            : effectivePrice_;
      } else {
        return effectivePriceBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Effective Price after applying the discounts.
     * </pre>
     *
     * <code>.google.type.Money effective_price = 3;</code>
     */
    public Builder setEffectivePrice(com.google.type.Money value) {
      if (effectivePriceBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        effectivePrice_ = value;
      } else {
        effectivePriceBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Effective Price after applying the discounts.
     * </pre>
     *
     * <code>.google.type.Money effective_price = 3;</code>
     */
    public Builder setEffectivePrice(com.google.type.Money.Builder builderForValue) {
      if (effectivePriceBuilder_ == null) {
        effectivePrice_ = builderForValue.build();
      } else {
        effectivePriceBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Effective Price after applying the discounts.
     * </pre>
     *
     * <code>.google.type.Money effective_price = 3;</code>
     */
    public Builder mergeEffectivePrice(com.google.type.Money value) {
      if (effectivePriceBuilder_ == null) {
        if (((bitField0_ & 0x00000004) != 0)
            && effectivePrice_ != null
            && effectivePrice_ != com.google.type.Money.getDefaultInstance()) {
          getEffectivePriceBuilder().mergeFrom(value);
        } else {
          effectivePrice_ = value;
        }
      } else {
        effectivePriceBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Effective Price after applying the discounts.
     * </pre>
     *
     * <code>.google.type.Money effective_price = 3;</code>
     */
    public Builder clearEffectivePrice() {
      bitField0_ = (bitField0_ & ~0x00000004);
      effectivePrice_ = null;
      if (effectivePriceBuilder_ != null) {
        effectivePriceBuilder_.dispose();
        effectivePriceBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Effective Price after applying the discounts.
     * </pre>
     *
     * <code>.google.type.Money effective_price = 3;</code>
     */
    public com.google.type.Money.Builder getEffectivePriceBuilder() {
      bitField0_ |= 0x00000004;
      onChanged();
      return getEffectivePriceFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Effective Price after applying the discounts.
     * </pre>
     *
     * <code>.google.type.Money effective_price = 3;</code>
     */
    public com.google.type.MoneyOrBuilder getEffectivePriceOrBuilder() {
      if (effectivePriceBuilder_ != null) {
        return effectivePriceBuilder_.getMessageOrBuilder();
      } else {
        return effectivePrice_ == null
            ? com.google.type.Money.getDefaultInstance()
            : effectivePrice_;
      }
    }
    /**
     *
     *
     * <pre>
     * Effective Price after applying the discounts.
     * </pre>
     *
     * <code>.google.type.Money effective_price = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder>
        getEffectivePriceFieldBuilder() {
      if (effectivePriceBuilder_ == null) {
        effectivePriceBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.type.Money,
                com.google.type.Money.Builder,
                com.google.type.MoneyOrBuilder>(
                getEffectivePrice(), getParentForChildren(), isClean());
        effectivePrice_ = null;
      }
      return effectivePriceBuilder_;
    }

    private java.lang.Object externalPriceUri_ = "";
    /**
     *
     *
     * <pre>
     * Link to external price list, such as link to Google Voice rate card.
     * </pre>
     *
     * <code>string external_price_uri = 4;</code>
     *
     * @return The externalPriceUri.
     */
    public java.lang.String getExternalPriceUri() {
      java.lang.Object ref = externalPriceUri_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        externalPriceUri_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Link to external price list, such as link to Google Voice rate card.
     * </pre>
     *
     * <code>string external_price_uri = 4;</code>
     *
     * @return The bytes for externalPriceUri.
     */
    public com.google.protobuf.ByteString getExternalPriceUriBytes() {
      java.lang.Object ref = externalPriceUri_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        externalPriceUri_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Link to external price list, such as link to Google Voice rate card.
     * </pre>
     *
     * <code>string external_price_uri = 4;</code>
     *
     * @param value The externalPriceUri to set.
     * @return This builder for chaining.
     */
    public Builder setExternalPriceUri(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      externalPriceUri_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Link to external price list, such as link to Google Voice rate card.
     * </pre>
     *
     * <code>string external_price_uri = 4;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearExternalPriceUri() {
      externalPriceUri_ = getDefaultInstance().getExternalPriceUri();
      bitField0_ = (bitField0_ & ~0x00000008);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Link to external price list, such as link to Google Voice rate card.
     * </pre>
     *
     * <code>string external_price_uri = 4;</code>
     *
     * @param value The bytes for externalPriceUri to set.
     * @return This builder for chaining.
     */
    public Builder setExternalPriceUriBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      externalPriceUri_ = value;
      bitField0_ |= 0x00000008;
      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.cloud.channel.v1.Price)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.channel.v1.Price)
  private static final com.google.cloud.channel.v1.Price DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.channel.v1.Price();
  }

  public static com.google.cloud.channel.v1.Price getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<Price> PARSER =
      new com.google.protobuf.AbstractParser<Price>() {
        @java.lang.Override
        public Price 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<Price> parser() {
    return PARSER;
  }

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

  @java.lang.Override
  public com.google.cloud.channel.v1.Price getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
