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

namespace Google\Cloud\Audit\BigQueryAuditMetadata\DatasetChange;

use UnexpectedValueException;

/**
 * Describes how the dataset was changed.
 *
 * Protobuf type <code>google.cloud.audit.BigQueryAuditMetadata.DatasetChange.Reason</code>
 */
class Reason
{
    /**
     * Unknown.
     *
     * Generated from protobuf enum <code>REASON_UNSPECIFIED = 0;</code>
     */
    const REASON_UNSPECIFIED = 0;
    /**
     * Dataset was changed using the datasets.update or datasets.patch API.
     *
     * Generated from protobuf enum <code>UPDATE = 1;</code>
     */
    const UPDATE = 1;
    /**
     * Dataset was changed using the SetIamPolicy API.
     *
     * Generated from protobuf enum <code>SET_IAM_POLICY = 2;</code>
     */
    const SET_IAM_POLICY = 2;
    /**
     * Dataset was changed using a query job, e.g., ALTER SCHEMA statement.
     *
     * Generated from protobuf enum <code>QUERY = 3;</code>
     */
    const QUERY = 3;

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

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

