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

namespace Google\Cloud\Channel\V1;

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

/**
 * Defines price at resource tier level.
 * For example, an offer with following definition :
 * * Tier 1: Provide 25% discount for all seats between 1 and 25.
 * * Tier 2: Provide 10% discount for all seats between 26 and 100.
 * * Tier 3: Provide flat 15% discount for all seats above 100.
 * Each of these tiers is represented as a PriceTier.
 *
 * Generated from protobuf message <code>google.cloud.channel.v1.PriceTier</code>
 */
class PriceTier extends \Google\Protobuf\Internal\Message
{
    /**
     * First resource for which the tier price applies.
     *
     * Generated from protobuf field <code>int32 first_resource = 1;</code>
     */
    private $first_resource = 0;
    /**
     * Last resource for which the tier price applies.
     *
     * Generated from protobuf field <code>int32 last_resource = 2;</code>
     */
    private $last_resource = 0;
    /**
     * Price of the tier.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.Price price = 3;</code>
     */
    private $price = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $first_resource
     *           First resource for which the tier price applies.
     *     @type int $last_resource
     *           Last resource for which the tier price applies.
     *     @type \Google\Cloud\Channel\V1\Price $price
     *           Price of the tier.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Channel\V1\Offers::initOnce();
        parent::__construct($data);
    }

    /**
     * First resource for which the tier price applies.
     *
     * Generated from protobuf field <code>int32 first_resource = 1;</code>
     * @return int
     */
    public function getFirstResource()
    {
        return $this->first_resource;
    }

    /**
     * First resource for which the tier price applies.
     *
     * Generated from protobuf field <code>int32 first_resource = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setFirstResource($var)
    {
        GPBUtil::checkInt32($var);
        $this->first_resource = $var;

        return $this;
    }

    /**
     * Last resource for which the tier price applies.
     *
     * Generated from protobuf field <code>int32 last_resource = 2;</code>
     * @return int
     */
    public function getLastResource()
    {
        return $this->last_resource;
    }

    /**
     * Last resource for which the tier price applies.
     *
     * Generated from protobuf field <code>int32 last_resource = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setLastResource($var)
    {
        GPBUtil::checkInt32($var);
        $this->last_resource = $var;

        return $this;
    }

    /**
     * Price of the tier.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.Price price = 3;</code>
     * @return \Google\Cloud\Channel\V1\Price|null
     */
    public function getPrice()
    {
        return isset($this->price) ? $this->price : null;
    }

    public function hasPrice()
    {
        return isset($this->price);
    }

    public function clearPrice()
    {
        unset($this->price);
    }

    /**
     * Price of the tier.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.Price price = 3;</code>
     * @param \Google\Cloud\Channel\V1\Price $var
     * @return $this
     */
    public function setPrice($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Channel\V1\Price::class);
        $this->price = $var;

        return $this;
    }

}

