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

namespace Google\Cloud\Functions\V1;

use UnexpectedValueException;

/**
 * A type of an operation.
 *
 * Protobuf type <code>google.cloud.functions.v1.OperationType</code>
 */
class OperationType
{
    /**
     * Unknown operation type.
     *
     * Generated from protobuf enum <code>OPERATION_UNSPECIFIED = 0;</code>
     */
    const OPERATION_UNSPECIFIED = 0;
    /**
     * Triggered by CreateFunction call
     *
     * Generated from protobuf enum <code>CREATE_FUNCTION = 1;</code>
     */
    const CREATE_FUNCTION = 1;
    /**
     * Triggered by UpdateFunction call
     *
     * Generated from protobuf enum <code>UPDATE_FUNCTION = 2;</code>
     */
    const UPDATE_FUNCTION = 2;
    /**
     * Triggered by DeleteFunction call.
     *
     * Generated from protobuf enum <code>DELETE_FUNCTION = 3;</code>
     */
    const DELETE_FUNCTION = 3;

    private static $valueToName = [
        self::OPERATION_UNSPECIFIED => 'OPERATION_UNSPECIFIED',
        self::CREATE_FUNCTION => 'CREATE_FUNCTION',
        self::UPDATE_FUNCTION => 'UPDATE_FUNCTION',
        self::DELETE_FUNCTION => 'DELETE_FUNCTION',
    ];

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

