<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: keyapis/telemetry_alerting/v1/keyapis_telemetry_alerting_trigger_v1.proto

namespace Keyapis\TelemetryAlerting\V1\Trigger;

use UnexpectedValueException;

/**
 * Справочник типов периодов контроля триггера
 *
 * Protobuf type <code>keyapis.telemetry_alerting.v1.Trigger.PeriodType</code>
 */
class PeriodType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>PERIOD_TYPE_UNKNOWN = 0;</code>
     */
    const PERIOD_TYPE_UNKNOWN = 0;
    /**
     * День
     *
     * Generated from protobuf enum <code>DAY = 1;</code>
     */
    const DAY = 1;
    /**
     * Месяц
     *
     * Generated from protobuf enum <code>MONTH = 2;</code>
     */
    const MONTH = 2;

    private static $valueToName = [
        self::PERIOD_TYPE_UNKNOWN => 'PERIOD_TYPE_UNKNOWN',
        self::DAY => 'DAY',
        self::MONTH => '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);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(PeriodType::class, \Keyapis\TelemetryAlerting\V1\Trigger_PeriodType::class);

