<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/apps/script/type/gmail/gmail_addon_manifest.proto

namespace Google\Apps\Script\Type\Gmail\ComposeTrigger;

use UnexpectedValueException;

/**
 * An enum defining the level of data access this compose trigger requires.
 *
 * Protobuf type <code>google.apps.script.type.gmail.ComposeTrigger.DraftAccess</code>
 */
class DraftAccess
{
    /**
     * Default value when nothing is set for DraftAccess.
     *
     * Generated from protobuf enum <code>UNSPECIFIED = 0;</code>
     */
    const UNSPECIFIED = 0;
    /**
     * NONE means compose trigger won't be able to access any data of the draft
     * when a compose addon is triggered.
     *
     * Generated from protobuf enum <code>NONE = 1;</code>
     */
    const NONE = 1;
    /**
     * METADATA gives compose trigger the permission to access the metadata of
     * the draft when a compose addon is triggered. This includes the audience
     * list (To/cc list) of a draft message.
     *
     * Generated from protobuf enum <code>METADATA = 2;</code>
     */
    const METADATA = 2;

    private static $valueToName = [
        self::UNSPECIFIED => 'UNSPECIFIED',
        self::NONE => 'NONE',
        self::METADATA => 'METADATA',
    ];

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