<?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;

/**
 * Represents price by resource type.
 *
 * Generated from protobuf message <code>google.cloud.channel.v1.PriceByResource</code>
 */
class PriceByResource extends \Google\Protobuf\Internal\Message
{
    /**
     * Resource Type. Example: SEAT
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.ResourceType resource_type = 1;</code>
     */
    private $resource_type = 0;
    /**
     * Price of the Offer. Present if there are no price phases.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.Price price = 2;</code>
     */
    private $price = null;
    /**
     * Specifies the price by time range.
     *
     * Generated from protobuf field <code>repeated .google.cloud.channel.v1.PricePhase price_phases = 3;</code>
     */
    private $price_phases;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $resource_type
     *           Resource Type. Example: SEAT
     *     @type \Google\Cloud\Channel\V1\Price $price
     *           Price of the Offer. Present if there are no price phases.
     *     @type array<\Google\Cloud\Channel\V1\PricePhase>|\Google\Protobuf\Internal\RepeatedField $price_phases
     *           Specifies the price by time range.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Channel\V1\Offers::initOnce();
        parent::__construct($data);
    }

    /**
     * Resource Type. Example: SEAT
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.ResourceType resource_type = 1;</code>
     * @return int
     */
    public function getResourceType()
    {
        return $this->resource_type;
    }

    /**
     * Resource Type. Example: SEAT
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.ResourceType resource_type = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setResourceType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Channel\V1\ResourceType::class);
        $this->resource_type = $var;

        return $this;
    }

    /**
     * Price of the Offer. Present if there are no price phases.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.Price price = 2;</code>
     * @return \Google\Cloud\Channel\V1\Price|null
     */
    public function getPrice()
    {
        return $this->price;
    }

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

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

    /**
     * Price of the Offer. Present if there are no price phases.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.Price price = 2;</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;
    }

    /**
     * Specifies the price by time range.
     *
     * Generated from protobuf field <code>repeated .google.cloud.channel.v1.PricePhase price_phases = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getPricePhases()
    {
        return $this->price_phases;
    }

    /**
     * Specifies the price by time range.
     *
     * Generated from protobuf field <code>repeated .google.cloud.channel.v1.PricePhase price_phases = 3;</code>
     * @param array<\Google\Cloud\Channel\V1\PricePhase>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setPricePhases($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Channel\V1\PricePhase::class);
        $this->price_phases = $arr;

        return $this;
    }

}

