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

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

use UnexpectedValueException;

/**
 * Enum describing possible goal errors.
 *
 * Protobuf type <code>google.ads.googleads.v23.errors.GoalErrorEnum.GoalError</code>
 */
class GoalError
{
    /**
     * Enum 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;
    /**
     * Retention goal already exists.
     *
     * Generated from protobuf enum <code>RETENTION_GOAL_ALREADY_EXISTS = 4;</code>
     */
    const RETENTION_GOAL_ALREADY_EXISTS = 4;
    /**
     * When using customer lifecycle optimization goal, if high lifetime value
     * is present then value should be present.
     *
     * Generated from protobuf enum <code>HIGH_LIFETIME_VALUE_PRESENT_BUT_VALUE_ABSENT = 5;</code>
     */
    const HIGH_LIFETIME_VALUE_PRESENT_BUT_VALUE_ABSENT = 5;
    /**
     * When using customer lifecycle optimization goal, high lifetime value
     * should be greater than value.
     *
     * Generated from protobuf enum <code>HIGH_LIFETIME_VALUE_LESS_THAN_OR_EQUAL_TO_VALUE = 6;</code>
     */
    const HIGH_LIFETIME_VALUE_LESS_THAN_OR_EQUAL_TO_VALUE = 6;
    /**
     * Only Google Ads account can have customer lifecycle optimization goal.
     *
     * Generated from protobuf enum <code>CUSTOMER_LIFECYCLE_OPTIMIZATION_ACCOUNT_TYPE_NOT_ALLOWED = 7;</code>
     */
    const CUSTOMER_LIFECYCLE_OPTIMIZATION_ACCOUNT_TYPE_NOT_ALLOWED = 7;

    private static $valueToName = [
        self::UNSPECIFIED => 'UNSPECIFIED',
        self::UNKNOWN => 'UNKNOWN',
        self::RETENTION_GOAL_ALREADY_EXISTS => 'RETENTION_GOAL_ALREADY_EXISTS',
        self::HIGH_LIFETIME_VALUE_PRESENT_BUT_VALUE_ABSENT => 'HIGH_LIFETIME_VALUE_PRESENT_BUT_VALUE_ABSENT',
        self::HIGH_LIFETIME_VALUE_LESS_THAN_OR_EQUAL_TO_VALUE => 'HIGH_LIFETIME_VALUE_LESS_THAN_OR_EQUAL_TO_VALUE',
        self::CUSTOMER_LIFECYCLE_OPTIMIZATION_ACCOUNT_TYPE_NOT_ALLOWED => 'CUSTOMER_LIFECYCLE_OPTIMIZATION_ACCOUNT_TYPE_NOT_ALLOWED',
    ];

    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(GoalError::class, \Google\Ads\GoogleAds\V23\Errors\GoalErrorEnum_GoalError::class);

