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

namespace Google\Cloud\PubSub\V1\IngestionFailureEvent;

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

/**
 * Failure when ingesting from a Confluent Cloud source.
 *
 * Generated from protobuf message <code>google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason</code>
 */
class ConfluentCloudFailureReason extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. The cluster ID containing the topic being ingested from.
     *
     * Generated from protobuf field <code>string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $cluster_id = '';
    /**
     * Optional. The name of the Kafka topic being ingested from.
     *
     * Generated from protobuf field <code>string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $kafka_topic = '';
    /**
     * Optional. The partition ID of the message that failed to be ingested.
     *
     * Generated from protobuf field <code>int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $partition_id = 0;
    /**
     * Optional. The offset within the partition of the message that failed to
     * be ingested.
     *
     * Generated from protobuf field <code>int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $offset = 0;
    protected $reason;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $cluster_id
     *           Optional. The cluster ID containing the topic being ingested from.
     *     @type string $kafka_topic
     *           Optional. The name of the Kafka topic being ingested from.
     *     @type int|string $partition_id
     *           Optional. The partition ID of the message that failed to be ingested.
     *     @type int|string $offset
     *           Optional. The offset within the partition of the message that failed to
     *           be ingested.
     *     @type \Google\Cloud\PubSub\V1\IngestionFailureEvent\ApiViolationReason $api_violation_reason
     *           Optional. The Pub/Sub API limits prevented the desired message from
     *           being published.
     *     @type \Google\Cloud\PubSub\V1\IngestionFailureEvent\SchemaViolationReason $schema_violation_reason
     *           Optional. The Pub/Sub message failed schema validation.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. The cluster ID containing the topic being ingested from.
     *
     * Generated from protobuf field <code>string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getClusterId()
    {
        return $this->cluster_id;
    }

    /**
     * Optional. The cluster ID containing the topic being ingested from.
     *
     * Generated from protobuf field <code>string cluster_id = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setClusterId($var)
    {
        GPBUtil::checkString($var, True);
        $this->cluster_id = $var;

        return $this;
    }

    /**
     * Optional. The name of the Kafka topic being ingested from.
     *
     * Generated from protobuf field <code>string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getKafkaTopic()
    {
        return $this->kafka_topic;
    }

    /**
     * Optional. The name of the Kafka topic being ingested from.
     *
     * Generated from protobuf field <code>string kafka_topic = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setKafkaTopic($var)
    {
        GPBUtil::checkString($var, True);
        $this->kafka_topic = $var;

        return $this;
    }

    /**
     * Optional. The partition ID of the message that failed to be ingested.
     *
     * Generated from protobuf field <code>int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int|string
     */
    public function getPartitionId()
    {
        return $this->partition_id;
    }

    /**
     * Optional. The partition ID of the message that failed to be ingested.
     *
     * Generated from protobuf field <code>int64 partition_id = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int|string $var
     * @return $this
     */
    public function setPartitionId($var)
    {
        GPBUtil::checkInt64($var);
        $this->partition_id = $var;

        return $this;
    }

    /**
     * Optional. The offset within the partition of the message that failed to
     * be ingested.
     *
     * Generated from protobuf field <code>int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int|string
     */
    public function getOffset()
    {
        return $this->offset;
    }

    /**
     * Optional. The offset within the partition of the message that failed to
     * be ingested.
     *
     * Generated from protobuf field <code>int64 offset = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int|string $var
     * @return $this
     */
    public function setOffset($var)
    {
        GPBUtil::checkInt64($var);
        $this->offset = $var;

        return $this;
    }

    /**
     * Optional. The Pub/Sub API limits prevented the desired message from
     * being published.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\PubSub\V1\IngestionFailureEvent\ApiViolationReason|null
     */
    public function getApiViolationReason()
    {
        return $this->readOneof(5);
    }

    public function hasApiViolationReason()
    {
        return $this->hasOneof(5);
    }

    /**
     * Optional. The Pub/Sub API limits prevented the desired message from
     * being published.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason api_violation_reason = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\PubSub\V1\IngestionFailureEvent\ApiViolationReason $var
     * @return $this
     */
    public function setApiViolationReason($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\IngestionFailureEvent\ApiViolationReason::class);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * Optional. The Pub/Sub message failed schema validation.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\PubSub\V1\IngestionFailureEvent\SchemaViolationReason|null
     */
    public function getSchemaViolationReason()
    {
        return $this->readOneof(6);
    }

    public function hasSchemaViolationReason()
    {
        return $this->hasOneof(6);
    }

    /**
     * Optional. The Pub/Sub message failed schema validation.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason schema_violation_reason = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\PubSub\V1\IngestionFailureEvent\SchemaViolationReason $var
     * @return $this
     */
    public function setSchemaViolationReason($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\IngestionFailureEvent\SchemaViolationReason::class);
        $this->writeOneof(6, $var);

        return $this;
    }

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

}


