<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/billing/v1/cloud_catalog.proto

namespace Google\Cloud\Billing\V1\PricingExpression;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * The price rate indicating starting usage and its corresponding price.
 *
 * Generated from protobuf message <code>google.cloud.billing.v1.PricingExpression.TierRate</code>
 */
class TierRate extends \Google\Protobuf\Internal\Message
{
    /**
     * Usage is priced at this rate only after this amount.
     * Example: start_usage_amount of 10 indicates that the usage will be priced
     * at the unit_price after the first 10 usage_units.
     *
     * Generated from protobuf field <code>double start_usage_amount = 1;</code>
     */
    private $start_usage_amount = 0.0;
    /**
     * The price per unit of usage.
     * Example: unit_price of amount $10 indicates that each unit will cost $10.
     *
     * Generated from protobuf field <code>.google.type.Money unit_price = 2;</code>
     */
    private $unit_price = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type float $start_usage_amount
     *           Usage is priced at this rate only after this amount.
     *           Example: start_usage_amount of 10 indicates that the usage will be priced
     *           at the unit_price after the first 10 usage_units.
     *     @type \Google\Type\Money $unit_price
     *           The price per unit of usage.
     *           Example: unit_price of amount $10 indicates that each unit will cost $10.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Billing\V1\CloudCatalog::initOnce();
        parent::__construct($data);
    }

    /**
     * Usage is priced at this rate only after this amount.
     * Example: start_usage_amount of 10 indicates that the usage will be priced
     * at the unit_price after the first 10 usage_units.
     *
     * Generated from protobuf field <code>double start_usage_amount = 1;</code>
     * @return float
     */
    public function getStartUsageAmount()
    {
        return $this->start_usage_amount;
    }

    /**
     * Usage is priced at this rate only after this amount.
     * Example: start_usage_amount of 10 indicates that the usage will be priced
     * at the unit_price after the first 10 usage_units.
     *
     * Generated from protobuf field <code>double start_usage_amount = 1;</code>
     * @param float $var
     * @return $this
     */
    public function setStartUsageAmount($var)
    {
        GPBUtil::checkDouble($var);
        $this->start_usage_amount = $var;

        return $this;
    }

    /**
     * The price per unit of usage.
     * Example: unit_price of amount $10 indicates that each unit will cost $10.
     *
     * Generated from protobuf field <code>.google.type.Money unit_price = 2;</code>
     * @return \Google\Type\Money
     */
    public function getUnitPrice()
    {
        return isset($this->unit_price) ? $this->unit_price : null;
    }

    public function hasUnitPrice()
    {
        return isset($this->unit_price);
    }

    public function clearUnitPrice()
    {
        unset($this->unit_price);
    }

    /**
     * The price per unit of usage.
     * Example: unit_price of amount $10 indicates that each unit will cost $10.
     *
     * Generated from protobuf field <code>.google.type.Money unit_price = 2;</code>
     * @param \Google\Type\Money $var
     * @return $this
     */
    public function setUnitPrice($var)
    {
        GPBUtil::checkMessage($var, \Google\Type\Money::class);
        $this->unit_price = $var;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(TierRate::class, \Google\Cloud\Billing\V1\PricingExpression_TierRate::class);

