<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/ads/googleads/v20/common/audience_insights_attribute.proto

namespace Google\Ads\GoogleAds\V20\Common;

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

/**
 * An entity or category representing a topic that defines an audience.
 *
 * Generated from protobuf message <code>google.ads.googleads.v20.common.AudienceInsightsTopic</code>
 */
class AudienceInsightsTopic extends \Google\Protobuf\Internal\Message
{
    protected $topic;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Ads\GoogleAds\V20\Common\AudienceInsightsEntity $entity
     *           A Knowledge Graph entity
     *     @type \Google\Ads\GoogleAds\V20\Common\AudienceInsightsCategory $category
     *           A Product & Service category
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Ads\GoogleAds\V20\Common\AudienceInsightsAttribute::initOnce();
        parent::__construct($data);
    }

    /**
     * A Knowledge Graph entity
     *
     * Generated from protobuf field <code>.google.ads.googleads.v20.common.AudienceInsightsEntity entity = 1;</code>
     * @return \Google\Ads\GoogleAds\V20\Common\AudienceInsightsEntity|null
     */
    public function getEntity()
    {
        return $this->readOneof(1);
    }

    public function hasEntity()
    {
        return $this->hasOneof(1);
    }

    /**
     * A Knowledge Graph entity
     *
     * Generated from protobuf field <code>.google.ads.googleads.v20.common.AudienceInsightsEntity entity = 1;</code>
     * @param \Google\Ads\GoogleAds\V20\Common\AudienceInsightsEntity $var
     * @return $this
     */
    public function setEntity($var)
    {
        GPBUtil::checkMessage($var, \Google\Ads\GoogleAds\V20\Common\AudienceInsightsEntity::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * A Product & Service category
     *
     * Generated from protobuf field <code>.google.ads.googleads.v20.common.AudienceInsightsCategory category = 2;</code>
     * @return \Google\Ads\GoogleAds\V20\Common\AudienceInsightsCategory|null
     */
    public function getCategory()
    {
        return $this->readOneof(2);
    }

    public function hasCategory()
    {
        return $this->hasOneof(2);
    }

    /**
     * A Product & Service category
     *
     * Generated from protobuf field <code>.google.ads.googleads.v20.common.AudienceInsightsCategory category = 2;</code>
     * @param \Google\Ads\GoogleAds\V20\Common\AudienceInsightsCategory $var
     * @return $this
     */
    public function setCategory($var)
    {
        GPBUtil::checkMessage($var, \Google\Ads\GoogleAds\V20\Common\AudienceInsightsCategory::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getTopic()
    {
        return $this->whichOneof("topic");
    }

}

