<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/analytics/admin/v1alpha/audience.proto

namespace Google\Analytics\Admin\V1alpha\AudienceEventTrigger;

use UnexpectedValueException;

/**
 * Determines when to log the event.
 *
 * Protobuf type <code>google.analytics.admin.v1alpha.AudienceEventTrigger.LogCondition</code>
 */
class LogCondition
{
    /**
     * Log condition is not specified.
     *
     * Generated from protobuf enum <code>LOG_CONDITION_UNSPECIFIED = 0;</code>
     */
    const LOG_CONDITION_UNSPECIFIED = 0;
    /**
     * The event should be logged only when a user is joined.
     *
     * Generated from protobuf enum <code>AUDIENCE_JOINED = 1;</code>
     */
    const AUDIENCE_JOINED = 1;
    /**
     * The event should be logged whenever the Audience condition is met, even
     * if the user is already a member of the Audience.
     *
     * Generated from protobuf enum <code>AUDIENCE_MEMBERSHIP_RENEWED = 2;</code>
     */
    const AUDIENCE_MEMBERSHIP_RENEWED = 2;

    private static $valueToName = [
        self::LOG_CONDITION_UNSPECIFIED => 'LOG_CONDITION_UNSPECIFIED',
        self::AUDIENCE_JOINED => 'AUDIENCE_JOINED',
        self::AUDIENCE_MEMBERSHIP_RENEWED => 'AUDIENCE_MEMBERSHIP_RENEWED',
    ];

    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);
    }
}


