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

namespace Google\Cloud\Ces\V1\Guardrail\LlmPolicy;

use UnexpectedValueException;

/**
 * Defines when to apply the policy check during the conversation.
 *
 * Protobuf type <code>google.cloud.ces.v1.Guardrail.LlmPolicy.PolicyScope</code>
 */
class PolicyScope
{
    /**
     * Policy scope is not specified.
     *
     * Generated from protobuf enum <code>POLICY_SCOPE_UNSPECIFIED = 0;</code>
     */
    const POLICY_SCOPE_UNSPECIFIED = 0;
    /**
     * Policy check is triggered on user input.
     *
     * Generated from protobuf enum <code>USER_QUERY = 1;</code>
     */
    const USER_QUERY = 1;
    /**
     * Policy check is triggered on agent response. Applying this policy
     * scope will introduce additional latency before the agent can respond.
     *
     * Generated from protobuf enum <code>AGENT_RESPONSE = 2;</code>
     */
    const AGENT_RESPONSE = 2;
    /**
     * Policy check is triggered on both user input and agent response.
     * Applying this policy scope will introduce additional latency before
     * the agent can respond.
     *
     * Generated from protobuf enum <code>USER_QUERY_AND_AGENT_RESPONSE = 3;</code>
     */
    const USER_QUERY_AND_AGENT_RESPONSE = 3;

    private static $valueToName = [
        self::POLICY_SCOPE_UNSPECIFIED => 'POLICY_SCOPE_UNSPECIFIED',
        self::USER_QUERY => 'USER_QUERY',
        self::AGENT_RESPONSE => 'AGENT_RESPONSE',
        self::USER_QUERY_AND_AGENT_RESPONSE => 'USER_QUERY_AND_AGENT_RESPONSE',
    ];

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

