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

namespace Google\Apps\Script\Type;

use UnexpectedValueException;

/**
 * Authorization header sent in add-on HTTP requests
 *
 * Protobuf type <code>google.apps.script.type.HttpAuthorizationHeader</code>
 */
class HttpAuthorizationHeader
{
    /**
     * Default value, equivalent to `SYSTEM_ID_TOKEN`
     *
     * Generated from protobuf enum <code>HTTP_AUTHORIZATION_HEADER_UNSPECIFIED = 0;</code>
     */
    const HTTP_AUTHORIZATION_HEADER_UNSPECIFIED = 0;
    /**
     * Send an ID token for the project-specific Google Workspace Add-ons system
     * service account (default)
     *
     * Generated from protobuf enum <code>SYSTEM_ID_TOKEN = 1;</code>
     */
    const SYSTEM_ID_TOKEN = 1;
    /**
     * Send an ID token for the end user
     *
     * Generated from protobuf enum <code>USER_ID_TOKEN = 2;</code>
     */
    const USER_ID_TOKEN = 2;
    /**
     * Do not send an Authentication header
     *
     * Generated from protobuf enum <code>NONE = 3;</code>
     */
    const NONE = 3;

    private static $valueToName = [
        self::HTTP_AUTHORIZATION_HEADER_UNSPECIFIED => 'HTTP_AUTHORIZATION_HEADER_UNSPECIFIED',
        self::SYSTEM_ID_TOKEN => 'SYSTEM_ID_TOKEN',
        self::USER_ID_TOKEN => 'USER_ID_TOKEN',
        self::NONE => 'NONE',
    ];

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

