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

namespace Google\Cloud\Chronicle\V1;

use UnexpectedValueException;

/**
 * RunFrequency indicates the run frequency at which a YARA-L 2 rule will run if
 * enabled.
 *
 * Protobuf type <code>google.cloud.chronicle.v1.RunFrequency</code>
 */
class RunFrequency
{
    /**
     * The run frequency is unspecified/unknown.
     *
     * Generated from protobuf enum <code>RUN_FREQUENCY_UNSPECIFIED = 0;</code>
     */
    const RUN_FREQUENCY_UNSPECIFIED = 0;
    /**
     * Executes in real time.
     *
     * Generated from protobuf enum <code>LIVE = 1;</code>
     */
    const LIVE = 1;
    /**
     * Executes once per hour.
     *
     * Generated from protobuf enum <code>HOURLY = 2;</code>
     */
    const HOURLY = 2;
    /**
     * Executes once per day.
     *
     * Generated from protobuf enum <code>DAILY = 3;</code>
     */
    const DAILY = 3;

    private static $valueToName = [
        self::RUN_FREQUENCY_UNSPECIFIED => 'RUN_FREQUENCY_UNSPECIFIED',
        self::LIVE => 'LIVE',
        self::HOURLY => 'HOURLY',
        self::DAILY => 'DAILY',
    ];

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

