<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/shopping/merchant/products/v1/products_common.proto

namespace Google\Shopping\Merchant\Products\V1;

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

/**
 * The SubscriptionCost of the product.
 *
 * Generated from protobuf message <code>google.shopping.merchant.products.v1.SubscriptionCost</code>
 */
class SubscriptionCost extends \Google\Protobuf\Internal\Message
{
    /**
     * The type of subscription period.
     * Supported values are:
     *   * "`month`"
     *   * "`year`"
     *   * "`week`"
     *
     * Generated from protobuf field <code>.google.shopping.merchant.products.v1.SubscriptionPeriod period = 1;</code>
     */
    protected $period = 0;
    /**
     * The number of subscription periods the buyer has to pay.
     *
     * Generated from protobuf field <code>int64 period_length = 2;</code>
     */
    protected $period_length = 0;
    /**
     * The amount the buyer has to pay per subscription period.
     *
     * Generated from protobuf field <code>.google.shopping.type.Price amount = 3;</code>
     */
    protected $amount = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $period
     *           The type of subscription period.
     *           Supported values are:
     *             * "`month`"
     *             * "`year`"
     *             * "`week`"
     *     @type int|string $period_length
     *           The number of subscription periods the buyer has to pay.
     *     @type \Google\Shopping\Type\Price $amount
     *           The amount the buyer has to pay per subscription period.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Shopping\Merchant\Products\V1\ProductsCommon::initOnce();
        parent::__construct($data);
    }

    /**
     * The type of subscription period.
     * Supported values are:
     *   * "`month`"
     *   * "`year`"
     *   * "`week`"
     *
     * Generated from protobuf field <code>.google.shopping.merchant.products.v1.SubscriptionPeriod period = 1;</code>
     * @return int
     */
    public function getPeriod()
    {
        return $this->period;
    }

    /**
     * The type of subscription period.
     * Supported values are:
     *   * "`month`"
     *   * "`year`"
     *   * "`week`"
     *
     * Generated from protobuf field <code>.google.shopping.merchant.products.v1.SubscriptionPeriod period = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setPeriod($var)
    {
        GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Products\V1\SubscriptionPeriod::class);
        $this->period = $var;

        return $this;
    }

    /**
     * The number of subscription periods the buyer has to pay.
     *
     * Generated from protobuf field <code>int64 period_length = 2;</code>
     * @return int|string
     */
    public function getPeriodLength()
    {
        return $this->period_length;
    }

    /**
     * The number of subscription periods the buyer has to pay.
     *
     * Generated from protobuf field <code>int64 period_length = 2;</code>
     * @param int|string $var
     * @return $this
     */
    public function setPeriodLength($var)
    {
        GPBUtil::checkInt64($var);
        $this->period_length = $var;

        return $this;
    }

    /**
     * The amount the buyer has to pay per subscription period.
     *
     * Generated from protobuf field <code>.google.shopping.type.Price amount = 3;</code>
     * @return \Google\Shopping\Type\Price|null
     */
    public function getAmount()
    {
        return $this->amount;
    }

    public function hasAmount()
    {
        return isset($this->amount);
    }

    public function clearAmount()
    {
        unset($this->amount);
    }

    /**
     * The amount the buyer has to pay per subscription period.
     *
     * Generated from protobuf field <code>.google.shopping.type.Price amount = 3;</code>
     * @param \Google\Shopping\Type\Price $var
     * @return $this
     */
    public function setAmount($var)
    {
        GPBUtil::checkMessage($var, \Google\Shopping\Type\Price::class);
        $this->amount = $var;

        return $this;
    }

}

