<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/apihub/v1/common_fields.proto

namespace Google\Cloud\ApiHub\V1\Spec;

use UnexpectedValueException;

/**
 * Specifies the parsing mode for API specifications during creation and
 * update.
 * - `RELAXED`: Parsing errors in the specification content do not fail the
 * API call.
 * - `STRICT`: Parsing errors in the specification content result in failure
 * of the API call.
 * If not specified, defaults to `RELAXED`.
 *
 * Protobuf type <code>google.cloud.apihub.v1.Spec.ParsingMode</code>
 */
class ParsingMode
{
    /**
     * Defaults to `RELAXED`.
     *
     * Generated from protobuf enum <code>PARSING_MODE_UNSPECIFIED = 0;</code>
     */
    const PARSING_MODE_UNSPECIFIED = 0;
    /**
     * Parsing of the Spec on create and update is relaxed, meaning that
     * parsing errors the spec contents will not fail the API call.
     *
     * Generated from protobuf enum <code>RELAXED = 1;</code>
     */
    const RELAXED = 1;
    /**
     * Parsing of the Spec on create and update is strict, meaning that
     * parsing errors in the spec contents will fail the API call.
     *
     * Generated from protobuf enum <code>STRICT = 2;</code>
     */
    const STRICT = 2;

    private static $valueToName = [
        self::PARSING_MODE_UNSPECIFIED => 'PARSING_MODE_UNSPECIFIED',
        self::RELAXED => 'RELAXED',
        self::STRICT => 'STRICT',
    ];

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


