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

namespace Google\Cloud\Audit\BigQueryAuditMetadata\RoutineCreation;

use UnexpectedValueException;

/**
 * Describes how the routine was created.
 *
 * Protobuf type <code>google.cloud.audit.BigQueryAuditMetadata.RoutineCreation.Reason</code>
 */
class Reason
{
    /**
     * Unknown.
     *
     * Generated from protobuf enum <code>REASON_UNSPECIFIED = 0;</code>
     */
    const REASON_UNSPECIFIED = 0;
    /**
     * Routine was created using a DDL query.
     *
     * Generated from protobuf enum <code>QUERY = 1;</code>
     */
    const QUERY = 1;
    /**
     * Routine was created using the routines.create API.
     *
     * Generated from protobuf enum <code>ROUTINE_INSERT_REQUEST = 2;</code>
     */
    const ROUTINE_INSERT_REQUEST = 2;

    private static $valueToName = [
        self::REASON_UNSPECIFIED => 'REASON_UNSPECIFIED',
        self::QUERY => 'QUERY',
        self::ROUTINE_INSERT_REQUEST => 'ROUTINE_INSERT_REQUEST',
    ];

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


