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

namespace Google\Apps\Card\V1\DecoratedText\SwitchControl;

use UnexpectedValueException;

/**
 * How the switch appears in the user interface.
 * [Google Workspace add-ons
 * and Chat apps](https://developers.google.com/workspace/extend):
 *
 * Protobuf type <code>google.apps.card.v1.DecoratedText.SwitchControl.ControlType</code>
 */
class ControlType
{
    /**
     * A toggle-style switch.
     *
     * Generated from protobuf enum <code>SWITCH = 0;</code>
     */
    const PBSWITCH = 0;
    /**
     * Deprecated in favor of `CHECK_BOX`.
     *
     * Generated from protobuf enum <code>CHECKBOX = 1;</code>
     */
    const CHECKBOX = 1;
    /**
     * A checkbox.
     *
     * Generated from protobuf enum <code>CHECK_BOX = 2;</code>
     */
    const CHECK_BOX = 2;

    private static $valueToName = [
        self::PBSWITCH => 'SWITCH',
        self::CHECKBOX => 'CHECKBOX',
        self::CHECK_BOX => 'CHECK_BOX',
    ];

    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)) {
            $pbconst =  __CLASS__. '::PB' . strtoupper($name);
            if (!defined($pbconst)) {
                throw new UnexpectedValueException(sprintf(
                        'Enum %s has no value defined for name %s', __CLASS__, $name));
            }
            return constant($pbconst);
        }
        return constant($const);
    }
}


