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

namespace Google\Cloud\SecurityCenter\V1p1beta1;

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

/**
 * Security Command Center's Notification
 *
 * Generated from protobuf message <code>google.cloud.securitycenter.v1p1beta1.NotificationMessage</code>
 */
class NotificationMessage extends \Google\Protobuf\Internal\Message
{
    /**
     * Name of the notification config that generated current notification.
     *
     * Generated from protobuf field <code>string notification_config_name = 1;</code>
     */
    private $notification_config_name = '';
    /**
     * The Cloud resource tied to the notification.
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1p1beta1.Resource resource = 3;</code>
     */
    private $resource = null;
    protected $event;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $notification_config_name
     *           Name of the notification config that generated current notification.
     *     @type \Google\Cloud\SecurityCenter\V1p1beta1\Finding $finding
     *           If it's a Finding based notification config, this field will be
     *           populated.
     *     @type \Google\Cloud\SecurityCenter\V1p1beta1\Resource $resource
     *           The Cloud resource tied to the notification.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Securitycenter\V1P1Beta1\NotificationMessage::initOnce();
        parent::__construct($data);
    }

    /**
     * Name of the notification config that generated current notification.
     *
     * Generated from protobuf field <code>string notification_config_name = 1;</code>
     * @return string
     */
    public function getNotificationConfigName()
    {
        return $this->notification_config_name;
    }

    /**
     * Name of the notification config that generated current notification.
     *
     * Generated from protobuf field <code>string notification_config_name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setNotificationConfigName($var)
    {
        GPBUtil::checkString($var, True);
        $this->notification_config_name = $var;

        return $this;
    }

    /**
     * If it's a Finding based notification config, this field will be
     * populated.
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1p1beta1.Finding finding = 2;</code>
     * @return \Google\Cloud\SecurityCenter\V1p1beta1\Finding
     */
    public function getFinding()
    {
        return $this->readOneof(2);
    }

    public function hasFinding()
    {
        return $this->hasOneof(2);
    }

    /**
     * If it's a Finding based notification config, this field will be
     * populated.
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1p1beta1.Finding finding = 2;</code>
     * @param \Google\Cloud\SecurityCenter\V1p1beta1\Finding $var
     * @return $this
     */
    public function setFinding($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Finding::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * The Cloud resource tied to the notification.
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1p1beta1.Resource resource = 3;</code>
     * @return \Google\Cloud\SecurityCenter\V1p1beta1\Resource
     */
    public function getResource()
    {
        return isset($this->resource) ? $this->resource : null;
    }

    public function hasResource()
    {
        return isset($this->resource);
    }

    public function clearResource()
    {
        unset($this->resource);
    }

    /**
     * The Cloud resource tied to the notification.
     *
     * Generated from protobuf field <code>.google.cloud.securitycenter.v1p1beta1.Resource resource = 3;</code>
     * @param \Google\Cloud\SecurityCenter\V1p1beta1\Resource $var
     * @return $this
     */
    public function setResource($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1p1beta1\Resource::class);
        $this->resource = $var;

        return $this;
    }

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

}

