<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/retail/v2/search_service.proto

namespace Google\Cloud\Retail\V2\SearchResponse;

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

/**
 * A facet result.
 *
 * Generated from protobuf message <code>google.cloud.retail.v2.SearchResponse.Facet</code>
 */
class Facet extends \Google\Protobuf\Internal\Message
{
    /**
     * The key for this facet. E.g., "colorFamilies" or "price" or
     * "attributes.attr1".
     *
     * Generated from protobuf field <code>string key = 1;</code>
     */
    private $key = '';
    /**
     * The facet values for this field.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.SearchResponse.Facet.FacetValue values = 2;</code>
     */
    private $values;
    /**
     * Whether the facet is dynamically generated.
     *
     * Generated from protobuf field <code>bool dynamic_facet = 3;</code>
     */
    private $dynamic_facet = false;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $key
     *           The key for this facet. E.g., "colorFamilies" or "price" or
     *           "attributes.attr1".
     *     @type array<\Google\Cloud\Retail\V2\SearchResponse\Facet\FacetValue>|\Google\Protobuf\Internal\RepeatedField $values
     *           The facet values for this field.
     *     @type bool $dynamic_facet
     *           Whether the facet is dynamically generated.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Retail\V2\SearchService::initOnce();
        parent::__construct($data);
    }

    /**
     * The key for this facet. E.g., "colorFamilies" or "price" or
     * "attributes.attr1".
     *
     * Generated from protobuf field <code>string key = 1;</code>
     * @return string
     */
    public function getKey()
    {
        return $this->key;
    }

    /**
     * The key for this facet. E.g., "colorFamilies" or "price" or
     * "attributes.attr1".
     *
     * Generated from protobuf field <code>string key = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setKey($var)
    {
        GPBUtil::checkString($var, True);
        $this->key = $var;

        return $this;
    }

    /**
     * The facet values for this field.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.SearchResponse.Facet.FacetValue values = 2;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getValues()
    {
        return $this->values;
    }

    /**
     * The facet values for this field.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.SearchResponse.Facet.FacetValue values = 2;</code>
     * @param array<\Google\Cloud\Retail\V2\SearchResponse\Facet\FacetValue>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setValues($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Retail\V2\SearchResponse\Facet\FacetValue::class);
        $this->values = $arr;

        return $this;
    }

    /**
     * Whether the facet is dynamically generated.
     *
     * Generated from protobuf field <code>bool dynamic_facet = 3;</code>
     * @return bool
     */
    public function getDynamicFacet()
    {
        return $this->dynamic_facet;
    }

    /**
     * Whether the facet is dynamically generated.
     *
     * Generated from protobuf field <code>bool dynamic_facet = 3;</code>
     * @param bool $var
     * @return $this
     */
    public function setDynamicFacet($var)
    {
        GPBUtil::checkBool($var);
        $this->dynamic_facet = $var;

        return $this;
    }

}


