<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: temporal/api/enums/v1/query.proto

namespace Temporal\Api\Enums\V1;

use UnexpectedValueException;

/**
 * Protobuf type <code>temporal.api.enums.v1.QueryRejectCondition</code>
 */
class QueryRejectCondition
{
    /**
     * Generated from protobuf enum <code>QUERY_REJECT_CONDITION_UNSPECIFIED = 0;</code>
     */
    const QUERY_REJECT_CONDITION_UNSPECIFIED = 0;
    /**
     * None indicates that query should not be rejected.
     *
     * Generated from protobuf enum <code>QUERY_REJECT_CONDITION_NONE = 1;</code>
     */
    const QUERY_REJECT_CONDITION_NONE = 1;
    /**
     * NotOpen indicates that query should be rejected if workflow is not open.
     *
     * Generated from protobuf enum <code>QUERY_REJECT_CONDITION_NOT_OPEN = 2;</code>
     */
    const QUERY_REJECT_CONDITION_NOT_OPEN = 2;
    /**
     * NotCompletedCleanly indicates that query should be rejected if workflow did not complete cleanly.
     *
     * Generated from protobuf enum <code>QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY = 3;</code>
     */
    const QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY = 3;

    private static $valueToName = [
        self::QUERY_REJECT_CONDITION_UNSPECIFIED => 'QUERY_REJECT_CONDITION_UNSPECIFIED',
        self::QUERY_REJECT_CONDITION_NONE => 'QUERY_REJECT_CONDITION_NONE',
        self::QUERY_REJECT_CONDITION_NOT_OPEN => 'QUERY_REJECT_CONDITION_NOT_OPEN',
        self::QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY => 'QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY',
    ];

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

