<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/ads/googleads/v21/resources/asset_group_listing_group_filter.proto

namespace Google\Ads\GoogleAds\V21\Resources\ListingGroupFilterDimension;

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

/**
 * One element of a category at a certain level. Top-level categories
 * are at level 1, their children at level 2, and so on. We currently support
 * up to 5 levels. The user must specify a dimension type that indicates the
 * level of the category. All cases of the same subdivision must have the same
 * dimension type (category level).
 *
 * Generated from protobuf message <code>google.ads.googleads.v21.resources.ListingGroupFilterDimension.ProductCategory</code>
 */
class ProductCategory extends \Google\Protobuf\Internal\Message
{
    /**
     * ID of the product category.
     * This ID is equivalent to the google_product_category ID as described in
     * this article: https://support.google.com/merchants/answer/6324436
     *
     * Generated from protobuf field <code>optional int64 category_id = 1;</code>
     */
    protected $category_id = null;
    /**
     * Indicates the level of the category in the taxonomy.
     *
     * Generated from protobuf field <code>.google.ads.googleads.v21.enums.ListingGroupFilterProductCategoryLevelEnum.ListingGroupFilterProductCategoryLevel level = 2;</code>
     */
    protected $level = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int|string $category_id
     *           ID of the product category.
     *           This ID is equivalent to the google_product_category ID as described in
     *           this article: https://support.google.com/merchants/answer/6324436
     *     @type int $level
     *           Indicates the level of the category in the taxonomy.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Ads\GoogleAds\V21\Resources\AssetGroupListingGroupFilter::initOnce();
        parent::__construct($data);
    }

    /**
     * ID of the product category.
     * This ID is equivalent to the google_product_category ID as described in
     * this article: https://support.google.com/merchants/answer/6324436
     *
     * Generated from protobuf field <code>optional int64 category_id = 1;</code>
     * @return int|string
     */
    public function getCategoryId()
    {
        return isset($this->category_id) ? $this->category_id : 0;
    }

    public function hasCategoryId()
    {
        return isset($this->category_id);
    }

    public function clearCategoryId()
    {
        unset($this->category_id);
    }

    /**
     * ID of the product category.
     * This ID is equivalent to the google_product_category ID as described in
     * this article: https://support.google.com/merchants/answer/6324436
     *
     * Generated from protobuf field <code>optional int64 category_id = 1;</code>
     * @param int|string $var
     * @return $this
     */
    public function setCategoryId($var)
    {
        GPBUtil::checkInt64($var);
        $this->category_id = $var;

        return $this;
    }

    /**
     * Indicates the level of the category in the taxonomy.
     *
     * Generated from protobuf field <code>.google.ads.googleads.v21.enums.ListingGroupFilterProductCategoryLevelEnum.ListingGroupFilterProductCategoryLevel level = 2;</code>
     * @return int
     */
    public function getLevel()
    {
        return $this->level;
    }

    /**
     * Indicates the level of the category in the taxonomy.
     *
     * Generated from protobuf field <code>.google.ads.googleads.v21.enums.ListingGroupFilterProductCategoryLevelEnum.ListingGroupFilterProductCategoryLevel level = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setLevel($var)
    {
        GPBUtil::checkEnum($var, \Google\Ads\GoogleAds\V21\Enums\ListingGroupFilterProductCategoryLevelEnum\ListingGroupFilterProductCategoryLevel::class);
        $this->level = $var;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProductCategory::class, \Google\Ads\GoogleAds\V21\Resources\ListingGroupFilterDimension_ProductCategory::class);

