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

namespace Google\Cloud\Retail\V2\CatalogAttribute;

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

/**
 * Possible options for the facet that corresponds to the current attribute
 * config.
 *
 * Generated from protobuf message <code>google.cloud.retail.v2.CatalogAttribute.FacetConfig</code>
 */
class FacetConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * If you don't set the facet
     * [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]
     * in the request to a numerical attribute, then we use the computed
     * intervals with rounded bounds obtained from all its product numerical
     * attribute values. The computed intervals might not be ideal for some
     * attributes. Therefore, we give you the option to overwrite them with the
     * facet_intervals field. The maximum of facet intervals per
     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 40. Each
     * interval must have a lower bound or an upper bound. If both bounds are
     * provided, then the lower bound must be smaller or equal than the upper
     * bound.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.Interval facet_intervals = 1;</code>
     */
    private $facet_intervals;
    /**
     * Each instance represents a list of attribute values to ignore as facet
     * values for a specific time range. The maximum number of instances per
     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 25.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues ignored_facet_values = 2;</code>
     */
    private $ignored_facet_values;
    /**
     * Each instance replaces a list of facet values by a merged facet
     * value. If a facet value is not in any list, then it will stay the same.
     * To avoid conflicts, only paths of length 1 are accepted. In other words,
     * if "dark_blue" merged into "BLUE", then the latter can't merge into
     * "blues" because this would create a path of length 2. The maximum number
     * of instances of MergedFacetValue per
     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 100. This
     * feature is available only for textual custom attributes.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue merged_facet_values = 3;</code>
     */
    private $merged_facet_values;
    /**
     * Use this field only if you want to merge a facet key into another facet
     * key.
     *
     * Generated from protobuf field <code>.google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet merged_facet = 4;</code>
     */
    private $merged_facet = null;
    /**
     * Set this field only if you want to rerank based on facet values engaged
     * by the user for the current key. This option is only possible for custom
     * facetable textual keys.
     *
     * Generated from protobuf field <code>.google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig rerank_config = 5;</code>
     */
    private $rerank_config = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array<\Google\Cloud\Retail\V2\Interval>|\Google\Protobuf\Internal\RepeatedField $facet_intervals
     *           If you don't set the facet
     *           [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]
     *           in the request to a numerical attribute, then we use the computed
     *           intervals with rounded bounds obtained from all its product numerical
     *           attribute values. The computed intervals might not be ideal for some
     *           attributes. Therefore, we give you the option to overwrite them with the
     *           facet_intervals field. The maximum of facet intervals per
     *           [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 40. Each
     *           interval must have a lower bound or an upper bound. If both bounds are
     *           provided, then the lower bound must be smaller or equal than the upper
     *           bound.
     *     @type array<\Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\IgnoredFacetValues>|\Google\Protobuf\Internal\RepeatedField $ignored_facet_values
     *           Each instance represents a list of attribute values to ignore as facet
     *           values for a specific time range. The maximum number of instances per
     *           [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 25.
     *     @type array<\Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\MergedFacetValue>|\Google\Protobuf\Internal\RepeatedField $merged_facet_values
     *           Each instance replaces a list of facet values by a merged facet
     *           value. If a facet value is not in any list, then it will stay the same.
     *           To avoid conflicts, only paths of length 1 are accepted. In other words,
     *           if "dark_blue" merged into "BLUE", then the latter can't merge into
     *           "blues" because this would create a path of length 2. The maximum number
     *           of instances of MergedFacetValue per
     *           [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 100. This
     *           feature is available only for textual custom attributes.
     *     @type \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\MergedFacet $merged_facet
     *           Use this field only if you want to merge a facet key into another facet
     *           key.
     *     @type \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\RerankConfig $rerank_config
     *           Set this field only if you want to rerank based on facet values engaged
     *           by the user for the current key. This option is only possible for custom
     *           facetable textual keys.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Retail\V2\Catalog::initOnce();
        parent::__construct($data);
    }

    /**
     * If you don't set the facet
     * [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]
     * in the request to a numerical attribute, then we use the computed
     * intervals with rounded bounds obtained from all its product numerical
     * attribute values. The computed intervals might not be ideal for some
     * attributes. Therefore, we give you the option to overwrite them with the
     * facet_intervals field. The maximum of facet intervals per
     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 40. Each
     * interval must have a lower bound or an upper bound. If both bounds are
     * provided, then the lower bound must be smaller or equal than the upper
     * bound.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.Interval facet_intervals = 1;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getFacetIntervals()
    {
        return $this->facet_intervals;
    }

    /**
     * If you don't set the facet
     * [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]
     * in the request to a numerical attribute, then we use the computed
     * intervals with rounded bounds obtained from all its product numerical
     * attribute values. The computed intervals might not be ideal for some
     * attributes. Therefore, we give you the option to overwrite them with the
     * facet_intervals field. The maximum of facet intervals per
     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 40. Each
     * interval must have a lower bound or an upper bound. If both bounds are
     * provided, then the lower bound must be smaller or equal than the upper
     * bound.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.Interval facet_intervals = 1;</code>
     * @param array<\Google\Cloud\Retail\V2\Interval>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setFacetIntervals($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Retail\V2\Interval::class);
        $this->facet_intervals = $arr;

        return $this;
    }

    /**
     * Each instance represents a list of attribute values to ignore as facet
     * values for a specific time range. The maximum number of instances per
     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 25.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues ignored_facet_values = 2;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getIgnoredFacetValues()
    {
        return $this->ignored_facet_values;
    }

    /**
     * Each instance represents a list of attribute values to ignore as facet
     * values for a specific time range. The maximum number of instances per
     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 25.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues ignored_facet_values = 2;</code>
     * @param array<\Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\IgnoredFacetValues>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setIgnoredFacetValues($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\IgnoredFacetValues::class);
        $this->ignored_facet_values = $arr;

        return $this;
    }

    /**
     * Each instance replaces a list of facet values by a merged facet
     * value. If a facet value is not in any list, then it will stay the same.
     * To avoid conflicts, only paths of length 1 are accepted. In other words,
     * if "dark_blue" merged into "BLUE", then the latter can't merge into
     * "blues" because this would create a path of length 2. The maximum number
     * of instances of MergedFacetValue per
     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 100. This
     * feature is available only for textual custom attributes.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue merged_facet_values = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getMergedFacetValues()
    {
        return $this->merged_facet_values;
    }

    /**
     * Each instance replaces a list of facet values by a merged facet
     * value. If a facet value is not in any list, then it will stay the same.
     * To avoid conflicts, only paths of length 1 are accepted. In other words,
     * if "dark_blue" merged into "BLUE", then the latter can't merge into
     * "blues" because this would create a path of length 2. The maximum number
     * of instances of MergedFacetValue per
     * [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 100. This
     * feature is available only for textual custom attributes.
     *
     * Generated from protobuf field <code>repeated .google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue merged_facet_values = 3;</code>
     * @param array<\Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\MergedFacetValue>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setMergedFacetValues($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\MergedFacetValue::class);
        $this->merged_facet_values = $arr;

        return $this;
    }

    /**
     * Use this field only if you want to merge a facet key into another facet
     * key.
     *
     * Generated from protobuf field <code>.google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet merged_facet = 4;</code>
     * @return \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\MergedFacet|null
     */
    public function getMergedFacet()
    {
        return $this->merged_facet;
    }

    public function hasMergedFacet()
    {
        return isset($this->merged_facet);
    }

    public function clearMergedFacet()
    {
        unset($this->merged_facet);
    }

    /**
     * Use this field only if you want to merge a facet key into another facet
     * key.
     *
     * Generated from protobuf field <code>.google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet merged_facet = 4;</code>
     * @param \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\MergedFacet $var
     * @return $this
     */
    public function setMergedFacet($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\MergedFacet::class);
        $this->merged_facet = $var;

        return $this;
    }

    /**
     * Set this field only if you want to rerank based on facet values engaged
     * by the user for the current key. This option is only possible for custom
     * facetable textual keys.
     *
     * Generated from protobuf field <code>.google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig rerank_config = 5;</code>
     * @return \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\RerankConfig|null
     */
    public function getRerankConfig()
    {
        return $this->rerank_config;
    }

    public function hasRerankConfig()
    {
        return isset($this->rerank_config);
    }

    public function clearRerankConfig()
    {
        unset($this->rerank_config);
    }

    /**
     * Set this field only if you want to rerank based on facet values engaged
     * by the user for the current key. This option is only possible for custom
     * facetable textual keys.
     *
     * Generated from protobuf field <code>.google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig rerank_config = 5;</code>
     * @param \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\RerankConfig $var
     * @return $this
     */
    public function setRerankConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Retail\V2\CatalogAttribute\FacetConfig\RerankConfig::class);
        $this->rerank_config = $var;

        return $this;
    }

}


