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

namespace Google\Cloud\Channel\V1;

use UnexpectedValueException;

/**
 * Period Type.
 *
 * Protobuf type <code>google.cloud.channel.v1.PeriodType</code>
 */
class PeriodType
{
    /**
     * Not used.
     *
     * Generated from protobuf enum <code>PERIOD_TYPE_UNSPECIFIED = 0;</code>
     */
    const PERIOD_TYPE_UNSPECIFIED = 0;
    /**
     * Day.
     *
     * Generated from protobuf enum <code>DAY = 1;</code>
     */
    const DAY = 1;
    /**
     * Month.
     *
     * Generated from protobuf enum <code>MONTH = 2;</code>
     */
    const MONTH = 2;
    /**
     * Year.
     *
     * Generated from protobuf enum <code>YEAR = 3;</code>
     */
    const YEAR = 3;

    private static $valueToName = [
        self::PERIOD_TYPE_UNSPECIFIED => 'PERIOD_TYPE_UNSPECIFIED',
        self::DAY => 'DAY',
        self::MONTH => 'MONTH',
        self::YEAR => 'YEAR',
    ];

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

