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

namespace Google\Cloud\Run\V2\ExecutionReference;

use UnexpectedValueException;

/**
 * Possible execution completion status.
 *
 * Protobuf type <code>google.cloud.run.v2.ExecutionReference.CompletionStatus</code>
 */
class CompletionStatus
{
    /**
     * The default value. This value is used if the state is omitted.
     *
     * Generated from protobuf enum <code>COMPLETION_STATUS_UNSPECIFIED = 0;</code>
     */
    const COMPLETION_STATUS_UNSPECIFIED = 0;
    /**
     * Job execution has succeeded.
     *
     * Generated from protobuf enum <code>EXECUTION_SUCCEEDED = 1;</code>
     */
    const EXECUTION_SUCCEEDED = 1;
    /**
     * Job execution has failed.
     *
     * Generated from protobuf enum <code>EXECUTION_FAILED = 2;</code>
     */
    const EXECUTION_FAILED = 2;
    /**
     * Job execution is running normally.
     *
     * Generated from protobuf enum <code>EXECUTION_RUNNING = 3;</code>
     */
    const EXECUTION_RUNNING = 3;
    /**
     * Waiting for backing resources to be provisioned.
     *
     * Generated from protobuf enum <code>EXECUTION_PENDING = 4;</code>
     */
    const EXECUTION_PENDING = 4;
    /**
     * Job execution has been cancelled by the user.
     *
     * Generated from protobuf enum <code>EXECUTION_CANCELLED = 5;</code>
     */
    const EXECUTION_CANCELLED = 5;

    private static $valueToName = [
        self::COMPLETION_STATUS_UNSPECIFIED => 'COMPLETION_STATUS_UNSPECIFIED',
        self::EXECUTION_SUCCEEDED => 'EXECUTION_SUCCEEDED',
        self::EXECUTION_FAILED => 'EXECUTION_FAILED',
        self::EXECUTION_RUNNING => 'EXECUTION_RUNNING',
        self::EXECUTION_PENDING => 'EXECUTION_PENDING',
        self::EXECUTION_CANCELLED => 'EXECUTION_CANCELLED',
    ];

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


