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

namespace Google\Cloud\Billing\Budgets\V1;

use UnexpectedValueException;

/**
 * A `CalendarPeriod` represents the abstract concept of a time period that
 * has a canonical start. Grammatically, "the start of the current
 * `CalendarPeriod`". All calendar times begin at 12 AM US and Canadian
 * Pacific Time (UTC-8).
 *
 * Protobuf type <code>google.cloud.billing.budgets.v1.CalendarPeriod</code>
 */
class CalendarPeriod
{
    /**
     * Generated from protobuf enum <code>CALENDAR_PERIOD_UNSPECIFIED = 0;</code>
     */
    const CALENDAR_PERIOD_UNSPECIFIED = 0;
    /**
     * A month. Month starts on the first day of each month, such as January 1,
     * February 1, March 1, and so on.
     *
     * Generated from protobuf enum <code>MONTH = 1;</code>
     */
    const MONTH = 1;
    /**
     * A quarter. Quarters start on dates January 1, April 1, July 1, and October
     * 1 of each year.
     *
     * Generated from protobuf enum <code>QUARTER = 2;</code>
     */
    const QUARTER = 2;
    /**
     * A year. Year starts on January 1.
     *
     * Generated from protobuf enum <code>YEAR = 3;</code>
     */
    const YEAR = 3;

    private static $valueToName = [
        self::CALENDAR_PERIOD_UNSPECIFIED => 'CALENDAR_PERIOD_UNSPECIFIED',
        self::MONTH => 'MONTH',
        self::QUARTER => 'QUARTER',
        self::YEAR => 'YEAR',
    ];

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

