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

namespace Google\Cloud\Run\V2\Condition;

use UnexpectedValueException;

/**
 * Represents the possible Condition states.
 *
 * Protobuf type <code>google.cloud.run.v2.Condition.State</code>
 */
class State
{
    /**
     * The default value. This value is used if the state is omitted.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Transient state: Reconciliation has not started yet.
     *
     * Generated from protobuf enum <code>CONDITION_PENDING = 1;</code>
     */
    const CONDITION_PENDING = 1;
    /**
     * Transient state: reconciliation is still in progress.
     *
     * Generated from protobuf enum <code>CONDITION_RECONCILING = 2;</code>
     */
    const CONDITION_RECONCILING = 2;
    /**
     * Terminal state: Reconciliation did not succeed.
     *
     * Generated from protobuf enum <code>CONDITION_FAILED = 3;</code>
     */
    const CONDITION_FAILED = 3;
    /**
     * Terminal state: Reconciliation completed successfully.
     *
     * Generated from protobuf enum <code>CONDITION_SUCCEEDED = 4;</code>
     */
    const CONDITION_SUCCEEDED = 4;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::CONDITION_PENDING => 'CONDITION_PENDING',
        self::CONDITION_RECONCILING => 'CONDITION_RECONCILING',
        self::CONDITION_FAILED => 'CONDITION_FAILED',
        self::CONDITION_SUCCEEDED => 'CONDITION_SUCCEEDED',
    ];

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


