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

namespace Google\Cloud\Ces\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * Guardrail contains a list of checks and balances to keep the agents safe and
 * secure.
 *
 * Generated from protobuf message <code>google.cloud.ces.v1.Guardrail</code>
 */
class Guardrail extends \Google\Protobuf\Internal\Message
{
    /**
     * Identifier. The unique identifier of the guardrail.
     * Format:
     * `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = IDENTIFIER];</code>
     */
    protected $name = '';
    /**
     * Required. Display name of the guardrail.
     *
     * Generated from protobuf field <code>string display_name = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $display_name = '';
    /**
     * Optional. Description of the guardrail.
     *
     * Generated from protobuf field <code>string description = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $description = '';
    /**
     * Optional. Whether the guardrail is enabled.
     *
     * Generated from protobuf field <code>bool enabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $enabled = false;
    /**
     * Optional. Action to take when the guardrail is triggered.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.TriggerAction action = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $action = null;
    /**
     * Output only. Timestamp when the guardrail was created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $create_time = null;
    /**
     * Output only. Timestamp when the guardrail was last updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $update_time = null;
    /**
     * Etag used to ensure the object hasn't changed during a read-modify-write
     * operation. If the etag is empty, the update will overwrite any concurrent
     * changes.
     *
     * Generated from protobuf field <code>string etag = 11;</code>
     */
    protected $etag = '';
    protected $guardrail_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Ces\V1\Guardrail\ContentFilter $content_filter
     *           Optional. Guardrail that bans certain content from being used in the
     *           conversation.
     *     @type \Google\Cloud\Ces\V1\Guardrail\LlmPromptSecurity $llm_prompt_security
     *           Optional. Guardrail that blocks the conversation if the prompt is
     *           considered unsafe based on the LLM classification.
     *     @type \Google\Cloud\Ces\V1\Guardrail\LlmPolicy $llm_policy
     *           Optional. Guardrail that blocks the conversation if the LLM response is
     *           considered violating the policy based on the LLM classification.
     *     @type \Google\Cloud\Ces\V1\Guardrail\ModelSafety $model_safety
     *           Optional. Guardrail that blocks the conversation if the LLM response is
     *           considered unsafe based on the model safety settings.
     *     @type \Google\Cloud\Ces\V1\Guardrail\CodeCallback $code_callback
     *           Optional. Guardrail that potentially blocks the conversation based on the
     *           result of the callback execution.
     *     @type string $name
     *           Identifier. The unique identifier of the guardrail.
     *           Format:
     *           `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
     *     @type string $display_name
     *           Required. Display name of the guardrail.
     *     @type string $description
     *           Optional. Description of the guardrail.
     *     @type bool $enabled
     *           Optional. Whether the guardrail is enabled.
     *     @type \Google\Cloud\Ces\V1\TriggerAction $action
     *           Optional. Action to take when the guardrail is triggered.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           Output only. Timestamp when the guardrail was created.
     *     @type \Google\Protobuf\Timestamp $update_time
     *           Output only. Timestamp when the guardrail was last updated.
     *     @type string $etag
     *           Etag used to ensure the object hasn't changed during a read-modify-write
     *           operation. If the etag is empty, the update will overwrite any concurrent
     *           changes.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Ces\V1\Guardrail::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. Guardrail that bans certain content from being used in the
     * conversation.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.ContentFilter content_filter = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Ces\V1\Guardrail\ContentFilter|null
     */
    public function getContentFilter()
    {
        return $this->readOneof(8);
    }

    public function hasContentFilter()
    {
        return $this->hasOneof(8);
    }

    /**
     * Optional. Guardrail that bans certain content from being used in the
     * conversation.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.ContentFilter content_filter = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Ces\V1\Guardrail\ContentFilter $var
     * @return $this
     */
    public function setContentFilter($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Ces\V1\Guardrail\ContentFilter::class);
        $this->writeOneof(8, $var);

        return $this;
    }

    /**
     * Optional. Guardrail that blocks the conversation if the prompt is
     * considered unsafe based on the LLM classification.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.LlmPromptSecurity llm_prompt_security = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Ces\V1\Guardrail\LlmPromptSecurity|null
     */
    public function getLlmPromptSecurity()
    {
        return $this->readOneof(9);
    }

    public function hasLlmPromptSecurity()
    {
        return $this->hasOneof(9);
    }

    /**
     * Optional. Guardrail that blocks the conversation if the prompt is
     * considered unsafe based on the LLM classification.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.LlmPromptSecurity llm_prompt_security = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Ces\V1\Guardrail\LlmPromptSecurity $var
     * @return $this
     */
    public function setLlmPromptSecurity($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Ces\V1\Guardrail\LlmPromptSecurity::class);
        $this->writeOneof(9, $var);

        return $this;
    }

    /**
     * Optional. Guardrail that blocks the conversation if the LLM response is
     * considered violating the policy based on the LLM classification.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.LlmPolicy llm_policy = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Ces\V1\Guardrail\LlmPolicy|null
     */
    public function getLlmPolicy()
    {
        return $this->readOneof(10);
    }

    public function hasLlmPolicy()
    {
        return $this->hasOneof(10);
    }

    /**
     * Optional. Guardrail that blocks the conversation if the LLM response is
     * considered violating the policy based on the LLM classification.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.LlmPolicy llm_policy = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Ces\V1\Guardrail\LlmPolicy $var
     * @return $this
     */
    public function setLlmPolicy($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Ces\V1\Guardrail\LlmPolicy::class);
        $this->writeOneof(10, $var);

        return $this;
    }

    /**
     * Optional. Guardrail that blocks the conversation if the LLM response is
     * considered unsafe based on the model safety settings.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.ModelSafety model_safety = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Ces\V1\Guardrail\ModelSafety|null
     */
    public function getModelSafety()
    {
        return $this->readOneof(13);
    }

    public function hasModelSafety()
    {
        return $this->hasOneof(13);
    }

    /**
     * Optional. Guardrail that blocks the conversation if the LLM response is
     * considered unsafe based on the model safety settings.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.ModelSafety model_safety = 13 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Ces\V1\Guardrail\ModelSafety $var
     * @return $this
     */
    public function setModelSafety($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Ces\V1\Guardrail\ModelSafety::class);
        $this->writeOneof(13, $var);

        return $this;
    }

    /**
     * Optional. Guardrail that potentially blocks the conversation based on the
     * result of the callback execution.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.CodeCallback code_callback = 14 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Ces\V1\Guardrail\CodeCallback|null
     */
    public function getCodeCallback()
    {
        return $this->readOneof(14);
    }

    public function hasCodeCallback()
    {
        return $this->hasOneof(14);
    }

    /**
     * Optional. Guardrail that potentially blocks the conversation based on the
     * result of the callback execution.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.Guardrail.CodeCallback code_callback = 14 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Ces\V1\Guardrail\CodeCallback $var
     * @return $this
     */
    public function setCodeCallback($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Ces\V1\Guardrail\CodeCallback::class);
        $this->writeOneof(14, $var);

        return $this;
    }

    /**
     * Identifier. The unique identifier of the guardrail.
     * Format:
     * `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = IDENTIFIER];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Identifier. The unique identifier of the guardrail.
     * Format:
     * `projects/{project}/locations/{location}/apps/{app}/guardrails/{guardrail}`
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = IDENTIFIER];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Required. Display name of the guardrail.
     *
     * Generated from protobuf field <code>string display_name = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getDisplayName()
    {
        return $this->display_name;
    }

    /**
     * Required. Display name of the guardrail.
     *
     * Generated from protobuf field <code>string display_name = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setDisplayName($var)
    {
        GPBUtil::checkString($var, True);
        $this->display_name = $var;

        return $this;
    }

    /**
     * Optional. Description of the guardrail.
     *
     * Generated from protobuf field <code>string description = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Optional. Description of the guardrail.
     *
     * Generated from protobuf field <code>string description = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setDescription($var)
    {
        GPBUtil::checkString($var, True);
        $this->description = $var;

        return $this;
    }

    /**
     * Optional. Whether the guardrail is enabled.
     *
     * Generated from protobuf field <code>bool enabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return bool
     */
    public function getEnabled()
    {
        return $this->enabled;
    }

    /**
     * Optional. Whether the guardrail is enabled.
     *
     * Generated from protobuf field <code>bool enabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param bool $var
     * @return $this
     */
    public function setEnabled($var)
    {
        GPBUtil::checkBool($var);
        $this->enabled = $var;

        return $this;
    }

    /**
     * Optional. Action to take when the guardrail is triggered.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.TriggerAction action = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Ces\V1\TriggerAction|null
     */
    public function getAction()
    {
        return $this->action;
    }

    public function hasAction()
    {
        return isset($this->action);
    }

    public function clearAction()
    {
        unset($this->action);
    }

    /**
     * Optional. Action to take when the guardrail is triggered.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.TriggerAction action = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Ces\V1\TriggerAction $var
     * @return $this
     */
    public function setAction($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Ces\V1\TriggerAction::class);
        $this->action = $var;

        return $this;
    }

    /**
     * Output only. Timestamp when the guardrail was created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    public function hasCreateTime()
    {
        return isset($this->create_time);
    }

    public function clearCreateTime()
    {
        unset($this->create_time);
    }

    /**
     * Output only. Timestamp when the guardrail was created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->create_time = $var;

        return $this;
    }

    /**
     * Output only. Timestamp when the guardrail was last updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getUpdateTime()
    {
        return $this->update_time;
    }

    public function hasUpdateTime()
    {
        return isset($this->update_time);
    }

    public function clearUpdateTime()
    {
        unset($this->update_time);
    }

    /**
     * Output only. Timestamp when the guardrail was last updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setUpdateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->update_time = $var;

        return $this;
    }

    /**
     * Etag used to ensure the object hasn't changed during a read-modify-write
     * operation. If the etag is empty, the update will overwrite any concurrent
     * changes.
     *
     * Generated from protobuf field <code>string etag = 11;</code>
     * @return string
     */
    public function getEtag()
    {
        return $this->etag;
    }

    /**
     * Etag used to ensure the object hasn't changed during a read-modify-write
     * operation. If the etag is empty, the update will overwrite any concurrent
     * changes.
     *
     * Generated from protobuf field <code>string etag = 11;</code>
     * @param string $var
     * @return $this
     */
    public function setEtag($var)
    {
        GPBUtil::checkString($var, True);
        $this->etag = $var;

        return $this;
    }

    /**
     * @return string
     */
    public function getGuardrailType()
    {
        return $this->whichOneof("guardrail_type");
    }

}

