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

namespace Google\Cloud\Channel\V1;

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

/**
 * Represents information which resellers will get as part of notification from
 * Pub/Sub.
 *
 * Generated from protobuf message <code>google.cloud.channel.v1.SubscriberEvent</code>
 */
class SubscriberEvent extends \Google\Protobuf\Internal\Message
{
    protected $event;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Channel\V1\CustomerEvent $customer_event
     *           Customer event sent as part of Pub/Sub event to partners.
     *     @type \Google\Cloud\Channel\V1\EntitlementEvent $entitlement_event
     *           Entitlement event sent as part of Pub/Sub event to partners.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Channel\V1\SubscriberEvent::initOnce();
        parent::__construct($data);
    }

    /**
     * Customer event sent as part of Pub/Sub event to partners.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.CustomerEvent customer_event = 1;</code>
     * @return \Google\Cloud\Channel\V1\CustomerEvent|null
     */
    public function getCustomerEvent()
    {
        return $this->readOneof(1);
    }

    public function hasCustomerEvent()
    {
        return $this->hasOneof(1);
    }

    /**
     * Customer event sent as part of Pub/Sub event to partners.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.CustomerEvent customer_event = 1;</code>
     * @param \Google\Cloud\Channel\V1\CustomerEvent $var
     * @return $this
     */
    public function setCustomerEvent($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Channel\V1\CustomerEvent::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Entitlement event sent as part of Pub/Sub event to partners.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.EntitlementEvent entitlement_event = 2;</code>
     * @return \Google\Cloud\Channel\V1\EntitlementEvent|null
     */
    public function getEntitlementEvent()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Entitlement event sent as part of Pub/Sub event to partners.
     *
     * Generated from protobuf field <code>.google.cloud.channel.v1.EntitlementEvent entitlement_event = 2;</code>
     * @param \Google\Cloud\Channel\V1\EntitlementEvent $var
     * @return $this
     */
    public function setEntitlementEvent($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Channel\V1\EntitlementEvent::class);
        $this->writeOneof(2, $var);

        return $this;
    }

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

}

