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

namespace Google\Cloud\Maintenance\Api\V1\ResourceMaintenance;

use UnexpectedValueException;

/**
 * State is the state of a resource maintenance.
 *
 * Protobuf type <code>google.cloud.maintenance.api.v1.ResourceMaintenance.State</code>
 */
class State
{
    /**
     * Unspecified state.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Scheduled for a particular window. For disruptive maintenance it should
     * respect maintenance policy, i.e. its available windows, exclusions and
     * notification period.
     *
     * Generated from protobuf enum <code>SCHEDULED = 1;</code>
     */
    const SCHEDULED = 1;
    /**
     * Maintenance is ongoing.
     *
     * Generated from protobuf enum <code>RUNNING = 2;</code>
     */
    const RUNNING = 2;
    /**
     * No longer planned, typically when other maintenance (e.g. upgrade to
     * newer version) already happened, or the user skipped the maintenance.
     *
     * Generated from protobuf enum <code>CANCELLED = 3;</code>
     */
    const CANCELLED = 3;
    /**
     * Successfully completed.
     *
     * Generated from protobuf enum <code>SUCCEEDED = 4;</code>
     */
    const SUCCEEDED = 4;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::SCHEDULED => 'SCHEDULED',
        self::RUNNING => 'RUNNING',
        self::CANCELLED => 'CANCELLED',
        self::SUCCEEDED => 'SUCCEEDED',
    ];

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


