<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/ads/admanager/v1/frequency_cap.proto

namespace Google\Ads\AdManager\V1;

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

/**
 * Represents a Frequency Cap that can be applied to an entity.
 *
 * Generated from protobuf message <code>google.ads.admanager.v1.FrequencyCap</code>
 */
class FrequencyCap extends \Google\Protobuf\Internal\Message
{
    /**
     * The maximum number of impressions for this frequency cap.
     *
     * Generated from protobuf field <code>optional int64 max_impressions = 1;</code>
     */
    protected $max_impressions = null;
    /**
     * The number of time units over which the frequency cap is effective.
     *
     * Generated from protobuf field <code>optional int64 time_amount = 2;</code>
     */
    protected $time_amount = null;
    /**
     * The units of time of this frequency cap.
     *
     * Generated from protobuf field <code>optional .google.ads.admanager.v1.TimeUnitEnum.TimeUnit time_unit = 3;</code>
     */
    protected $time_unit = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int|string $max_impressions
     *           The maximum number of impressions for this frequency cap.
     *     @type int|string $time_amount
     *           The number of time units over which the frequency cap is effective.
     *     @type int $time_unit
     *           The units of time of this frequency cap.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Ads\Admanager\V1\FrequencyCap::initOnce();
        parent::__construct($data);
    }

    /**
     * The maximum number of impressions for this frequency cap.
     *
     * Generated from protobuf field <code>optional int64 max_impressions = 1;</code>
     * @return int|string
     */
    public function getMaxImpressions()
    {
        return isset($this->max_impressions) ? $this->max_impressions : 0;
    }

    public function hasMaxImpressions()
    {
        return isset($this->max_impressions);
    }

    public function clearMaxImpressions()
    {
        unset($this->max_impressions);
    }

    /**
     * The maximum number of impressions for this frequency cap.
     *
     * Generated from protobuf field <code>optional int64 max_impressions = 1;</code>
     * @param int|string $var
     * @return $this
     */
    public function setMaxImpressions($var)
    {
        GPBUtil::checkInt64($var);
        $this->max_impressions = $var;

        return $this;
    }

    /**
     * The number of time units over which the frequency cap is effective.
     *
     * Generated from protobuf field <code>optional int64 time_amount = 2;</code>
     * @return int|string
     */
    public function getTimeAmount()
    {
        return isset($this->time_amount) ? $this->time_amount : 0;
    }

    public function hasTimeAmount()
    {
        return isset($this->time_amount);
    }

    public function clearTimeAmount()
    {
        unset($this->time_amount);
    }

    /**
     * The number of time units over which the frequency cap is effective.
     *
     * Generated from protobuf field <code>optional int64 time_amount = 2;</code>
     * @param int|string $var
     * @return $this
     */
    public function setTimeAmount($var)
    {
        GPBUtil::checkInt64($var);
        $this->time_amount = $var;

        return $this;
    }

    /**
     * The units of time of this frequency cap.
     *
     * Generated from protobuf field <code>optional .google.ads.admanager.v1.TimeUnitEnum.TimeUnit time_unit = 3;</code>
     * @return int
     */
    public function getTimeUnit()
    {
        return isset($this->time_unit) ? $this->time_unit : 0;
    }

    public function hasTimeUnit()
    {
        return isset($this->time_unit);
    }

    public function clearTimeUnit()
    {
        unset($this->time_unit);
    }

    /**
     * The units of time of this frequency cap.
     *
     * Generated from protobuf field <code>optional .google.ads.admanager.v1.TimeUnitEnum.TimeUnit time_unit = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setTimeUnit($var)
    {
        GPBUtil::checkEnum($var, \Google\Ads\AdManager\V1\TimeUnitEnum\TimeUnit::class);
        $this->time_unit = $var;

        return $this;
    }

}

