<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/ads/googleads/v20/errors/product_link_invitation_error.proto

namespace Google\Ads\GoogleAds\V20\Errors\ProductLinkInvitationErrorEnum;

use UnexpectedValueException;

/**
 * Enum describing possible product link invitation errors.
 *
 * Protobuf type <code>google.ads.googleads.v20.errors.ProductLinkInvitationErrorEnum.ProductLinkInvitationError</code>
 */
class ProductLinkInvitationError
{
    /**
     * Enum unspecified.
     *
     * Generated from protobuf enum <code>UNSPECIFIED = 0;</code>
     */
    const UNSPECIFIED = 0;
    /**
     * The received error code is not known in the version.
     *
     * Generated from protobuf enum <code>UNKNOWN = 1;</code>
     */
    const UNKNOWN = 1;
    /**
     * The invitation status is invalid.
     *
     * Generated from protobuf enum <code>INVALID_STATUS = 2;</code>
     */
    const INVALID_STATUS = 2;
    /**
     * The customer doesn't have the permission to perform this action
     *
     * Generated from protobuf enum <code>PERMISSION_DENIED = 3;</code>
     */
    const PERMISSION_DENIED = 3;
    /**
     * An invitation could not be created, since the user already has admin
     * access to the invited account. Use the ProductLinkService to directly
     * create an active link.
     *
     * Generated from protobuf enum <code>NO_INVITATION_REQUIRED = 4;</code>
     */
    const NO_INVITATION_REQUIRED = 4;
    /**
     * The customer is not permitted to create the invitation.
     *
     * Generated from protobuf enum <code>CUSTOMER_NOT_PERMITTED_TO_CREATE_INVITATION = 5;</code>
     */
    const CUSTOMER_NOT_PERMITTED_TO_CREATE_INVITATION = 5;

    private static $valueToName = [
        self::UNSPECIFIED => 'UNSPECIFIED',
        self::UNKNOWN => 'UNKNOWN',
        self::INVALID_STATUS => 'INVALID_STATUS',
        self::PERMISSION_DENIED => 'PERMISSION_DENIED',
        self::NO_INVITATION_REQUIRED => 'NO_INVITATION_REQUIRED',
        self::CUSTOMER_NOT_PERMITTED_TO_CREATE_INVITATION => 'CUSTOMER_NOT_PERMITTED_TO_CREATE_INVITATION',
    ];

    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(ProductLinkInvitationError::class, \Google\Ads\GoogleAds\V20\Errors\ProductLinkInvitationErrorEnum_ProductLinkInvitationError::class);

