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

namespace Google\Cloud\BigQuery\DataTransfer\V1;

use UnexpectedValueException;

/**
 * Options for writing to the table.
 * The WRITE_EMPTY option is intentionally excluded from the enum and is not
 * supported by the data transfer service.
 *
 * Protobuf type <code>google.cloud.bigquery.datatransfer.v1.WriteDisposition</code>
 */
class WriteDisposition
{
    /**
     * The default writeDispostion
     *
     * Generated from protobuf enum <code>WRITE_DISPOSITION_UNSPECIFIED = 0;</code>
     */
    const WRITE_DISPOSITION_UNSPECIFIED = 0;
    /**
     * overwrites the table data.
     *
     * Generated from protobuf enum <code>WRITE_TRUNCATE = 1;</code>
     */
    const WRITE_TRUNCATE = 1;
    /**
     * the data is appended to the table.
     * Note duplication might happen if this mode is used.
     *
     * Generated from protobuf enum <code>WRITE_APPEND = 2;</code>
     */
    const WRITE_APPEND = 2;

    private static $valueToName = [
        self::WRITE_DISPOSITION_UNSPECIFIED => 'WRITE_DISPOSITION_UNSPECIFIED',
        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);
    }
}

