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

namespace Google\Apps\Script\Type\Calendar\CalendarAddOnManifest;

use UnexpectedValueException;

/**
 * An enum defining the level of data access event triggers require.
 *
 * Protobuf type <code>google.apps.script.type.calendar.CalendarAddOnManifest.EventAccess</code>
 */
class EventAccess
{
    /**
     * Default value when nothing is set for EventAccess.
     *
     * Generated from protobuf enum <code>UNSPECIFIED = 0;</code>
     */
    const UNSPECIFIED = 0;
    /**
     * METADATA gives event triggers the permission to access the metadata of
     * events such as event id and calendar id.
     *
     * Generated from protobuf enum <code>METADATA = 1;</code>
     */
    const METADATA = 1;
    /**
     * READ gives event triggers access to all provided event fields including
     * the metadata, attendees, and conference data.
     *
     * Generated from protobuf enum <code>READ = 3;</code>
     */
    const READ = 3;
    /**
     * WRITE gives event triggers access to the metadata of events and the
     * ability to perform all actions, including adding attendees and setting
     * conference data.
     *
     * Generated from protobuf enum <code>WRITE = 4;</code>
     */
    const WRITE = 4;
    /**
     * READ_WRITE gives event triggers access to all provided event fields
     * including the metadata, attendees, and conference data and the ability to
     * perform all actions.
     *
     * Generated from protobuf enum <code>READ_WRITE = 5;</code>
     */
    const READ_WRITE = 5;

    private static $valueToName = [
        self::UNSPECIFIED => 'UNSPECIFIED',
        self::METADATA => 'METADATA',
        self::READ => 'READ',
        self::WRITE => 'WRITE',
        self::READ_WRITE => 'READ_WRITE',
    ];

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