<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/ads/googleads/v23/errors/search_term_insight_error.proto

namespace Google\Ads\GoogleAds\V23\Errors\SearchTermInsightErrorEnum;

use UnexpectedValueException;

/**
 * Enum describing possible search term insight errors.
 *
 * Protobuf type <code>google.ads.googleads.v23.errors.SearchTermInsightErrorEnum.SearchTermInsightError</code>
 */
class SearchTermInsightError
{
    /**
     * Name unspecified.
     *
     * Generated from protobuf enum <code>UNSPECIFIED = 0;</code>
     */
    const UNSPECIFIED = 0;
    /**
     * The received error code is not known in this version.
     *
     * Generated from protobuf enum <code>UNKNOWN = 1;</code>
     */
    const UNKNOWN = 1;
    /**
     * Search term insights cannot be filtered by metrics when segmenting.
     *
     * Generated from protobuf enum <code>FILTERING_NOT_ALLOWED_WITH_SEGMENTS = 2;</code>
     */
    const FILTERING_NOT_ALLOWED_WITH_SEGMENTS = 2;
    /**
     * Search term insights cannot have a LIMIT when segmenting.
     *
     * Generated from protobuf enum <code>LIMIT_NOT_ALLOWED_WITH_SEGMENTS = 3;</code>
     */
    const LIMIT_NOT_ALLOWED_WITH_SEGMENTS = 3;
    /**
     * A selected field requires another field to be selected with it.
     *
     * Generated from protobuf enum <code>MISSING_FIELD_IN_SELECT_CLAUSE = 4;</code>
     */
    const MISSING_FIELD_IN_SELECT_CLAUSE = 4;
    /**
     * A selected field/resource requires filtering by a single resource.
     *
     * Generated from protobuf enum <code>REQUIRES_FILTER_BY_SINGLE_RESOURCE = 5;</code>
     */
    const REQUIRES_FILTER_BY_SINGLE_RESOURCE = 5;
    /**
     * Search term insights cannot be sorted when segmenting.
     *
     * Generated from protobuf enum <code>SORTING_NOT_ALLOWED_WITH_SEGMENTS = 6;</code>
     */
    const SORTING_NOT_ALLOWED_WITH_SEGMENTS = 6;
    /**
     * Search term insights cannot have a summary row when segmenting.
     *
     * Generated from protobuf enum <code>SUMMARY_ROW_NOT_ALLOWED_WITH_SEGMENTS = 7;</code>
     */
    const SUMMARY_ROW_NOT_ALLOWED_WITH_SEGMENTS = 7;

    private static $valueToName = [
        self::UNSPECIFIED => 'UNSPECIFIED',
        self::UNKNOWN => 'UNKNOWN',
        self::FILTERING_NOT_ALLOWED_WITH_SEGMENTS => 'FILTERING_NOT_ALLOWED_WITH_SEGMENTS',
        self::LIMIT_NOT_ALLOWED_WITH_SEGMENTS => 'LIMIT_NOT_ALLOWED_WITH_SEGMENTS',
        self::MISSING_FIELD_IN_SELECT_CLAUSE => 'MISSING_FIELD_IN_SELECT_CLAUSE',
        self::REQUIRES_FILTER_BY_SINGLE_RESOURCE => 'REQUIRES_FILTER_BY_SINGLE_RESOURCE',
        self::SORTING_NOT_ALLOWED_WITH_SEGMENTS => 'SORTING_NOT_ALLOWED_WITH_SEGMENTS',
        self::SUMMARY_ROW_NOT_ALLOWED_WITH_SEGMENTS => 'SUMMARY_ROW_NOT_ALLOWED_WITH_SEGMENTS',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(SearchTermInsightError::class, \Google\Ads\GoogleAds\V23\Errors\SearchTermInsightErrorEnum_SearchTermInsightError::class);

