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

namespace Google\Cloud\Compute\V1\Commitment;

use UnexpectedValueException;

/**
 * The plan for this commitment, which determines duration and discount rate. The currently supported plans are TWELVE_MONTH (1 year), and THIRTY_SIX_MONTH (3 years).
 *
 * Protobuf type <code>google.cloud.compute.v1.Commitment.Plan</code>
 */
class Plan
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_PLAN = 0;</code>
     */
    const UNDEFINED_PLAN = 0;
    /**
     * Generated from protobuf enum <code>INVALID = 530283991;</code>
     */
    const INVALID = 530283991;
    /**
     * Generated from protobuf enum <code>THIRTY_SIX_MONTH = 266295942;</code>
     */
    const THIRTY_SIX_MONTH = 266295942;
    /**
     * Generated from protobuf enum <code>TWELVE_MONTH = 173083962;</code>
     */
    const TWELVE_MONTH = 173083962;

    private static $valueToName = [
        self::UNDEFINED_PLAN => 'UNDEFINED_PLAN',
        self::INVALID => 'INVALID',
        self::THIRTY_SIX_MONTH => 'THIRTY_SIX_MONTH',
        self::TWELVE_MONTH => 'TWELVE_MONTH',
    ];

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


