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

namespace Google\Cloud\BackupDR\V1\WeekDayOfMonth;

use UnexpectedValueException;

/**
 * `WeekOfMonth` enumerates possible weeks in the month, e.g. the first,
 * third, or last week of the month.
 *
 * Protobuf type <code>google.cloud.backupdr.v1.WeekDayOfMonth.WeekOfMonth</code>
 */
class WeekOfMonth
{
    /**
     * The zero value. Do not use.
     *
     * Generated from protobuf enum <code>WEEK_OF_MONTH_UNSPECIFIED = 0;</code>
     */
    const WEEK_OF_MONTH_UNSPECIFIED = 0;
    /**
     * The first week of the month.
     *
     * Generated from protobuf enum <code>FIRST = 1;</code>
     */
    const FIRST = 1;
    /**
     * The second week of the month.
     *
     * Generated from protobuf enum <code>SECOND = 2;</code>
     */
    const SECOND = 2;
    /**
     * The third week of the month.
     *
     * Generated from protobuf enum <code>THIRD = 3;</code>
     */
    const THIRD = 3;
    /**
     * The fourth  week of the month.
     *
     * Generated from protobuf enum <code>FOURTH = 4;</code>
     */
    const FOURTH = 4;
    /**
     * The last  week of the month.
     *
     * Generated from protobuf enum <code>LAST = 5;</code>
     */
    const LAST = 5;

    private static $valueToName = [
        self::WEEK_OF_MONTH_UNSPECIFIED => 'WEEK_OF_MONTH_UNSPECIFIED',
        self::FIRST => 'FIRST',
        self::SECOND => 'SECOND',
        self::THIRD => 'THIRD',
        self::FOURTH => 'FOURTH',
        self::LAST => 'LAST',
    ];

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

