<?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 overwrite or append the existing destination
 * table if it already exists.
 *
 * Protobuf type <code>google.cloud.audit.BigQueryAuditMetadata.WriteDisposition</code>
 */
class WriteDisposition
{
    /**
     * Unknown.
     *
     * Generated from protobuf enum <code>WRITE_DISPOSITION_UNSPECIFIED = 0;</code>
     */
    const WRITE_DISPOSITION_UNSPECIFIED = 0;
    /**
     * This job should only be writing to empty tables.
     *
     * Generated from protobuf enum <code>WRITE_EMPTY = 1;</code>
     */
    const WRITE_EMPTY = 1;
    /**
     * This job will truncate the existing table data.
     *
     * Generated from protobuf enum <code>WRITE_TRUNCATE = 2;</code>
     */
    const WRITE_TRUNCATE = 2;
    /**
     * This job will append to the table.
     *
     * Generated from protobuf enum <code>WRITE_APPEND = 3;</code>
     */
    const WRITE_APPEND = 3;

    private static $valueToName = [
        self::WRITE_DISPOSITION_UNSPECIFIED => 'WRITE_DISPOSITION_UNSPECIFIED',
        self::WRITE_EMPTY => 'WRITE_EMPTY',
        self::WRITE_TRUNCATE => 'WRITE_TRUNCATE',
        self::WRITE_APPEND => 'WRITE_APPEND',
    ];

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


