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

namespace Google\Cloud\OsConfig\V1\RecurringSchedule;

use UnexpectedValueException;

/**
 * Specifies the frequency of the recurring patch deployments.
 *
 * Protobuf type <code>google.cloud.osconfig.v1.RecurringSchedule.Frequency</code>
 */
class Frequency
{
    /**
     * Invalid. A frequency must be specified.
     *
     * Generated from protobuf enum <code>FREQUENCY_UNSPECIFIED = 0;</code>
     */
    const FREQUENCY_UNSPECIFIED = 0;
    /**
     * Indicates that the frequency of recurrence should be expressed in terms
     * of weeks.
     *
     * Generated from protobuf enum <code>WEEKLY = 1;</code>
     */
    const WEEKLY = 1;
    /**
     * Indicates that the frequency of recurrence should be expressed in terms
     * of months.
     *
     * Generated from protobuf enum <code>MONTHLY = 2;</code>
     */
    const MONTHLY = 2;
    /**
     * Indicates that the frequency of recurrence should be expressed in terms
     * of days.
     *
     * Generated from protobuf enum <code>DAILY = 3;</code>
     */
    const DAILY = 3;

    private static $valueToName = [
        self::FREQUENCY_UNSPECIFIED => 'FREQUENCY_UNSPECIFIED',
        self::WEEKLY => 'WEEKLY',
        self::MONTHLY => 'MONTHLY',
        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);
    }
}


