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

namespace Google\Ads\AdManager\V1\TimeUnitEnum;

use UnexpectedValueException;

/**
 * Unit of time for the frequency cap.
 *
 * Protobuf type <code>google.ads.admanager.v1.TimeUnitEnum.TimeUnit</code>
 */
class TimeUnit
{
    /**
     * Default value. This value is unused.
     *
     * Generated from protobuf enum <code>TIME_UNIT_UNSPECIFIED = 0;</code>
     */
    const TIME_UNIT_UNSPECIFIED = 0;
    /**
     * Minute
     *
     * Generated from protobuf enum <code>MINUTE = 1;</code>
     */
    const MINUTE = 1;
    /**
     * Hour
     *
     * Generated from protobuf enum <code>HOUR = 2;</code>
     */
    const HOUR = 2;
    /**
     * Day
     *
     * Generated from protobuf enum <code>DAY = 3;</code>
     */
    const DAY = 3;
    /**
     * Week
     *
     * Generated from protobuf enum <code>WEEK = 4;</code>
     */
    const WEEK = 4;
    /**
     * Month
     *
     * Generated from protobuf enum <code>MONTH = 5;</code>
     */
    const MONTH = 5;
    /**
     * Lifetime
     *
     * Generated from protobuf enum <code>LIFETIME = 6;</code>
     */
    const LIFETIME = 6;
    /**
     * Per pod of ads in a video stream. Only valid for entities in a
     * VIDEO_PLAYER environment.
     *
     * Generated from protobuf enum <code>POD = 7;</code>
     */
    const POD = 7;
    /**
     * Per video stream. Only valid for entities in a VIDEO_PLAYER environment.
     *
     * Generated from protobuf enum <code>STREAM = 8;</code>
     */
    const STREAM = 8;

    private static $valueToName = [
        self::TIME_UNIT_UNSPECIFIED => 'TIME_UNIT_UNSPECIFIED',
        self::MINUTE => 'MINUTE',
        self::HOUR => 'HOUR',
        self::DAY => 'DAY',
        self::WEEK => 'WEEK',
        self::MONTH => 'MONTH',
        self::LIFETIME => 'LIFETIME',
        self::POD => 'POD',
        self::STREAM => 'STREAM',
    ];

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


