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

namespace Google\Cloud\Domains\V1alpha2\RegisterParameters;

use UnexpectedValueException;

/**
 * Possible availability states of a domain name.
 *
 * Protobuf type <code>google.cloud.domains.v1alpha2.RegisterParameters.Availability</code>
 */
class Availability
{
    /**
     * The availability is unspecified.
     *
     * Generated from protobuf enum <code>AVAILABILITY_UNSPECIFIED = 0;</code>
     */
    const AVAILABILITY_UNSPECIFIED = 0;
    /**
     * The domain is available for registration.
     *
     * Generated from protobuf enum <code>AVAILABLE = 1;</code>
     */
    const AVAILABLE = 1;
    /**
     * The domain is not available for registration. Generally this means it is
     * already registered to another party.
     *
     * Generated from protobuf enum <code>UNAVAILABLE = 2;</code>
     */
    const UNAVAILABLE = 2;
    /**
     * The domain is not currently supported by Cloud Domains, but may
     * be available elsewhere.
     *
     * Generated from protobuf enum <code>UNSUPPORTED = 3;</code>
     */
    const UNSUPPORTED = 3;
    /**
     * Cloud Domains is unable to determine domain availability, generally
     * due to system maintenance at the domain name registry.
     *
     * Generated from protobuf enum <code>UNKNOWN = 4;</code>
     */
    const UNKNOWN = 4;

    private static $valueToName = [
        self::AVAILABILITY_UNSPECIFIED => 'AVAILABILITY_UNSPECIFIED',
        self::AVAILABLE => 'AVAILABLE',
        self::UNAVAILABLE => 'UNAVAILABLE',
        self::UNSUPPORTED => 'UNSUPPORTED',
        self::UNKNOWN => 'UNKNOWN',
    ];

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

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Availability::class, \Google\Cloud\Domains\V1alpha2\RegisterParameters_Availability::class);

