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

namespace Google\Cloud\DataCatalog\V1;

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

/**
 * The set of all usage signals that Data Catalog stores.
 * Note: Usually, these signals are updated daily. In rare cases, an update may
 * fail but will be performed again on the next day.
 *
 * Generated from protobuf message <code>google.cloud.datacatalog.v1.UsageSignal</code>
 */
class UsageSignal extends \Google\Protobuf\Internal\Message
{
    /**
     * The end timestamp of the duration of usage statistics.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 1;</code>
     */
    protected $update_time = null;
    /**
     * Output only. BigQuery usage statistics over each of the predefined time
     * ranges.
     * Supported time ranges are `{"24H", "7D", "30D"}`.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.datacatalog.v1.UsageStats> usage_within_time_range = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $usage_within_time_range;
    /**
     * Common usage statistics over each of the predefined time ranges.
     * Supported time ranges are `{"24H", "7D", "30D", "Lifetime"}`.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.datacatalog.v1.CommonUsageStats> common_usage_within_time_range = 3;</code>
     */
    private $common_usage_within_time_range;
    /**
     * Favorite count in the source system.
     *
     * Generated from protobuf field <code>optional int64 favorite_count = 4;</code>
     */
    protected $favorite_count = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\Timestamp $update_time
     *           The end timestamp of the duration of usage statistics.
     *     @type array|\Google\Protobuf\Internal\MapField $usage_within_time_range
     *           Output only. BigQuery usage statistics over each of the predefined time
     *           ranges.
     *           Supported time ranges are `{"24H", "7D", "30D"}`.
     *     @type array|\Google\Protobuf\Internal\MapField $common_usage_within_time_range
     *           Common usage statistics over each of the predefined time ranges.
     *           Supported time ranges are `{"24H", "7D", "30D", "Lifetime"}`.
     *     @type int|string $favorite_count
     *           Favorite count in the source system.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Datacatalog\V1\Usage::initOnce();
        parent::__construct($data);
    }

    /**
     * The end timestamp of the duration of usage statistics.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 1;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getUpdateTime()
    {
        return $this->update_time;
    }

    public function hasUpdateTime()
    {
        return isset($this->update_time);
    }

    public function clearUpdateTime()
    {
        unset($this->update_time);
    }

    /**
     * The end timestamp of the duration of usage statistics.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 1;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setUpdateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->update_time = $var;

        return $this;
    }

    /**
     * Output only. BigQuery usage statistics over each of the predefined time
     * ranges.
     * Supported time ranges are `{"24H", "7D", "30D"}`.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.datacatalog.v1.UsageStats> usage_within_time_range = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getUsageWithinTimeRange()
    {
        return $this->usage_within_time_range;
    }

    /**
     * Output only. BigQuery usage statistics over each of the predefined time
     * ranges.
     * Supported time ranges are `{"24H", "7D", "30D"}`.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.datacatalog.v1.UsageStats> usage_within_time_range = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setUsageWithinTimeRange($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DataCatalog\V1\UsageStats::class);
        $this->usage_within_time_range = $arr;

        return $this;
    }

    /**
     * Common usage statistics over each of the predefined time ranges.
     * Supported time ranges are `{"24H", "7D", "30D", "Lifetime"}`.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.datacatalog.v1.CommonUsageStats> common_usage_within_time_range = 3;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getCommonUsageWithinTimeRange()
    {
        return $this->common_usage_within_time_range;
    }

    /**
     * Common usage statistics over each of the predefined time ranges.
     * Supported time ranges are `{"24H", "7D", "30D", "Lifetime"}`.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.datacatalog.v1.CommonUsageStats> common_usage_within_time_range = 3;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setCommonUsageWithinTimeRange($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DataCatalog\V1\CommonUsageStats::class);
        $this->common_usage_within_time_range = $arr;

        return $this;
    }

    /**
     * Favorite count in the source system.
     *
     * Generated from protobuf field <code>optional int64 favorite_count = 4;</code>
     * @return int|string
     */
    public function getFavoriteCount()
    {
        return isset($this->favorite_count) ? $this->favorite_count : 0;
    }

    public function hasFavoriteCount()
    {
        return isset($this->favorite_count);
    }

    public function clearFavoriteCount()
    {
        unset($this->favorite_count);
    }

    /**
     * Favorite count in the source system.
     *
     * Generated from protobuf field <code>optional int64 favorite_count = 4;</code>
     * @param int|string $var
     * @return $this
     */
    public function setFavoriteCount($var)
    {
        GPBUtil::checkInt64($var);
        $this->favorite_count = $var;

        return $this;
    }

}

