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

namespace Google\Cloud\Dataflow\V1beta3;

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

/**
 * Information about an individual work item execution.
 *
 * Generated from protobuf message <code>google.dataflow.v1beta3.WorkItemDetails</code>
 */
class WorkItemDetails extends \Google\Protobuf\Internal\Message
{
    /**
     * Name of this work item.
     *
     * Generated from protobuf field <code>string task_id = 1;</code>
     */
    private $task_id = '';
    /**
     * Attempt ID of this work item
     *
     * Generated from protobuf field <code>string attempt_id = 2;</code>
     */
    private $attempt_id = '';
    /**
     * Start time of this work item attempt.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp start_time = 3;</code>
     */
    private $start_time = null;
    /**
     * End time of this work item attempt.
     * If the work item is completed, this is the actual end time of the work
     * item.  Otherwise, it is the predicted end time.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp end_time = 4;</code>
     */
    private $end_time = null;
    /**
     * State of this work item.
     *
     * Generated from protobuf field <code>.google.dataflow.v1beta3.ExecutionState state = 5;</code>
     */
    private $state = 0;
    /**
     * Progress of this work item.
     *
     * Generated from protobuf field <code>.google.dataflow.v1beta3.ProgressTimeseries progress = 6;</code>
     */
    private $progress = null;
    /**
     * Metrics for this work item.
     *
     * Generated from protobuf field <code>repeated .google.dataflow.v1beta3.MetricUpdate metrics = 7;</code>
     */
    private $metrics;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $task_id
     *           Name of this work item.
     *     @type string $attempt_id
     *           Attempt ID of this work item
     *     @type \Google\Protobuf\Timestamp $start_time
     *           Start time of this work item attempt.
     *     @type \Google\Protobuf\Timestamp $end_time
     *           End time of this work item attempt.
     *           If the work item is completed, this is the actual end time of the work
     *           item.  Otherwise, it is the predicted end time.
     *     @type int $state
     *           State of this work item.
     *     @type \Google\Cloud\Dataflow\V1beta3\ProgressTimeseries $progress
     *           Progress of this work item.
     *     @type array<\Google\Cloud\Dataflow\V1beta3\MetricUpdate>|\Google\Protobuf\Internal\RepeatedField $metrics
     *           Metrics for this work item.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Dataflow\V1Beta3\Metrics::initOnce();
        parent::__construct($data);
    }

    /**
     * Name of this work item.
     *
     * Generated from protobuf field <code>string task_id = 1;</code>
     * @return string
     */
    public function getTaskId()
    {
        return $this->task_id;
    }

    /**
     * Name of this work item.
     *
     * Generated from protobuf field <code>string task_id = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setTaskId($var)
    {
        GPBUtil::checkString($var, True);
        $this->task_id = $var;

        return $this;
    }

    /**
     * Attempt ID of this work item
     *
     * Generated from protobuf field <code>string attempt_id = 2;</code>
     * @return string
     */
    public function getAttemptId()
    {
        return $this->attempt_id;
    }

    /**
     * Attempt ID of this work item
     *
     * Generated from protobuf field <code>string attempt_id = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setAttemptId($var)
    {
        GPBUtil::checkString($var, True);
        $this->attempt_id = $var;

        return $this;
    }

    /**
     * Start time of this work item attempt.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp start_time = 3;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getStartTime()
    {
        return $this->start_time;
    }

    public function hasStartTime()
    {
        return isset($this->start_time);
    }

    public function clearStartTime()
    {
        unset($this->start_time);
    }

    /**
     * Start time of this work item attempt.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp start_time = 3;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setStartTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->start_time = $var;

        return $this;
    }

    /**
     * End time of this work item attempt.
     * If the work item is completed, this is the actual end time of the work
     * item.  Otherwise, it is the predicted end time.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp end_time = 4;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getEndTime()
    {
        return $this->end_time;
    }

    public function hasEndTime()
    {
        return isset($this->end_time);
    }

    public function clearEndTime()
    {
        unset($this->end_time);
    }

    /**
     * End time of this work item attempt.
     * If the work item is completed, this is the actual end time of the work
     * item.  Otherwise, it is the predicted end time.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp end_time = 4;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setEndTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->end_time = $var;

        return $this;
    }

    /**
     * State of this work item.
     *
     * Generated from protobuf field <code>.google.dataflow.v1beta3.ExecutionState state = 5;</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * State of this work item.
     *
     * Generated from protobuf field <code>.google.dataflow.v1beta3.ExecutionState state = 5;</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Dataflow\V1beta3\ExecutionState::class);
        $this->state = $var;

        return $this;
    }

    /**
     * Progress of this work item.
     *
     * Generated from protobuf field <code>.google.dataflow.v1beta3.ProgressTimeseries progress = 6;</code>
     * @return \Google\Cloud\Dataflow\V1beta3\ProgressTimeseries|null
     */
    public function getProgress()
    {
        return $this->progress;
    }

    public function hasProgress()
    {
        return isset($this->progress);
    }

    public function clearProgress()
    {
        unset($this->progress);
    }

    /**
     * Progress of this work item.
     *
     * Generated from protobuf field <code>.google.dataflow.v1beta3.ProgressTimeseries progress = 6;</code>
     * @param \Google\Cloud\Dataflow\V1beta3\ProgressTimeseries $var
     * @return $this
     */
    public function setProgress($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataflow\V1beta3\ProgressTimeseries::class);
        $this->progress = $var;

        return $this;
    }

    /**
     * Metrics for this work item.
     *
     * Generated from protobuf field <code>repeated .google.dataflow.v1beta3.MetricUpdate metrics = 7;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getMetrics()
    {
        return $this->metrics;
    }

    /**
     * Metrics for this work item.
     *
     * Generated from protobuf field <code>repeated .google.dataflow.v1beta3.MetricUpdate metrics = 7;</code>
     * @param array<\Google\Cloud\Dataflow\V1beta3\MetricUpdate>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setMetrics($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataflow\V1beta3\MetricUpdate::class);
        $this->metrics = $arr;

        return $this;
    }

}

