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

namespace Google\Cloud\Audit\BigQueryAuditMetadata;

use UnexpectedValueException;

/**
 * Describes whether a job should create a destination table if it doesn't
 * exist.
 *
 * Protobuf type <code>google.cloud.audit.BigQueryAuditMetadata.CreateDisposition</code>
 */
class CreateDisposition
{
    /**
     * Unknown.
     *
     * Generated from protobuf enum <code>CREATE_DISPOSITION_UNSPECIFIED = 0;</code>
     */
    const CREATE_DISPOSITION_UNSPECIFIED = 0;
    /**
     * This job should never create tables.
     *
     * Generated from protobuf enum <code>CREATE_NEVER = 1;</code>
     */
    const CREATE_NEVER = 1;
    /**
     * This job should create a table if it doesn't already exist.
     *
     * Generated from protobuf enum <code>CREATE_IF_NEEDED = 2;</code>
     */
    const CREATE_IF_NEEDED = 2;

    private static $valueToName = [
        self::CREATE_DISPOSITION_UNSPECIFIED => 'CREATE_DISPOSITION_UNSPECIFIED',
        self::CREATE_NEVER => 'CREATE_NEVER',
        self::CREATE_IF_NEEDED => 'CREATE_IF_NEEDED',
    ];

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

