<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/tasks/v2beta3/task.proto

namespace Google\Cloud\Tasks\V2beta3;

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

/**
 * A unit of scheduled work.
 *
 * Generated from protobuf message <code>google.cloud.tasks.v2beta3.Task</code>
 */
class Task extends \Google\Protobuf\Internal\Message
{
    /**
     * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
     * The task name.
     * The task name must have the following format:
     * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
     * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
     *    hyphens (-), colons (:), or periods (.).
     *    For more information, see
     *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
     * * `LOCATION_ID` is the canonical ID for the task's location.
     *    The list of available locations can be obtained by calling
     *    [ListLocations][google.cloud.location.Locations.ListLocations].
     *    For more information, see https://cloud.google.com/about/locations/.
     * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
     *   hyphens (-). The maximum length is 100 characters.
     * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
     *   hyphens (-), or underscores (_). The maximum length is 500 characters.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * `schedule_time` will be truncated to the nearest microsecond.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp schedule_time = 4;</code>
     */
    private $schedule_time = null;
    /**
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 5;</code>
     */
    private $create_time = null;
    /**
     * Output only. The number of attempts dispatched.
     * This count includes tasks which have been dispatched but haven't
     * received a response.
     *
     * Generated from protobuf field <code>int32 dispatch_count = 6;</code>
     */
    private $dispatch_count = 0;
    /**
     * Output only. The number of attempts which have received a response.
     *
     * Generated from protobuf field <code>int32 response_count = 7;</code>
     */
    private $response_count = 0;
    /**
     * Output only. The status of the task's first attempt.
     * Only [dispatch_time][google.cloud.tasks.v2beta3.Attempt.dispatch_time] will be set.
     * The other [Attempt][google.cloud.tasks.v2beta3.Attempt] information is not retained by Cloud Tasks.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.Attempt first_attempt = 8;</code>
     */
    private $first_attempt = null;
    /**
     * Output only. The status of the task's last attempt.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.Attempt last_attempt = 9;</code>
     */
    private $last_attempt = null;
    /**
     * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] has
     * been returned.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.Task.View view = 10;</code>
     */
    private $view = 0;
    protected $payload_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
     *           The task name.
     *           The task name must have the following format:
     *           `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
     *           * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
     *              hyphens (-), colons (:), or periods (.).
     *              For more information, see
     *              [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
     *           * `LOCATION_ID` is the canonical ID for the task's location.
     *              The list of available locations can be obtained by calling
     *              [ListLocations][google.cloud.location.Locations.ListLocations].
     *              For more information, see https://cloud.google.com/about/locations/.
     *           * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
     *             hyphens (-). The maximum length is 100 characters.
     *           * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
     *             hyphens (-), or underscores (_). The maximum length is 500 characters.
     *     @type \Google\Cloud\Tasks\V2beta3\AppEngineHttpRequest $app_engine_http_request
     *           App Engine HTTP request that is sent to the task's target. Can
     *           be set only if
     *           [app_engine_http_queue][google.cloud.tasks.v2beta3.Queue.app_engine_http_queue] is set
     *           on the queue.
     *           An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] set.
     *     @type \Google\Protobuf\Timestamp $schedule_time
     *           The time when the task is scheduled to be attempted.
     *           For App Engine queues, this is when the task will be attempted or retried.
     *           `schedule_time` will be truncated to the nearest microsecond.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           Output only. The time that the task was created.
     *           `create_time` will be truncated to the nearest second.
     *     @type int $dispatch_count
     *           Output only. The number of attempts dispatched.
     *           This count includes tasks which have been dispatched but haven't
     *           received a response.
     *     @type int $response_count
     *           Output only. The number of attempts which have received a response.
     *     @type \Google\Cloud\Tasks\V2beta3\Attempt $first_attempt
     *           Output only. The status of the task's first attempt.
     *           Only [dispatch_time][google.cloud.tasks.v2beta3.Attempt.dispatch_time] will be set.
     *           The other [Attempt][google.cloud.tasks.v2beta3.Attempt] information is not retained by Cloud Tasks.
     *     @type \Google\Cloud\Tasks\V2beta3\Attempt $last_attempt
     *           Output only. The status of the task's last attempt.
     *     @type int $view
     *           Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] has
     *           been returned.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Tasks\V2Beta3\Task::initOnce();
        parent::__construct($data);
    }

    /**
     * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
     * The task name.
     * The task name must have the following format:
     * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
     * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
     *    hyphens (-), colons (:), or periods (.).
     *    For more information, see
     *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
     * * `LOCATION_ID` is the canonical ID for the task's location.
     *    The list of available locations can be obtained by calling
     *    [ListLocations][google.cloud.location.Locations.ListLocations].
     *    For more information, see https://cloud.google.com/about/locations/.
     * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
     *   hyphens (-). The maximum length is 100 characters.
     * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
     *   hyphens (-), or underscores (_). The maximum length is 500 characters.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
     * The task name.
     * The task name must have the following format:
     * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
     * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
     *    hyphens (-), colons (:), or periods (.).
     *    For more information, see
     *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
     * * `LOCATION_ID` is the canonical ID for the task's location.
     *    The list of available locations can be obtained by calling
     *    [ListLocations][google.cloud.location.Locations.ListLocations].
     *    For more information, see https://cloud.google.com/about/locations/.
     * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
     *   hyphens (-). The maximum length is 100 characters.
     * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
     *   hyphens (-), or underscores (_). The maximum length is 500 characters.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_queue][google.cloud.tasks.v2beta3.Queue.app_engine_http_queue] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] set.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.AppEngineHttpRequest app_engine_http_request = 3;</code>
     * @return \Google\Cloud\Tasks\V2beta3\AppEngineHttpRequest
     */
    public function getAppEngineHttpRequest()
    {
        return $this->readOneof(3);
    }

    /**
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_queue][google.cloud.tasks.v2beta3.Queue.app_engine_http_queue] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] set.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.AppEngineHttpRequest app_engine_http_request = 3;</code>
     * @param \Google\Cloud\Tasks\V2beta3\AppEngineHttpRequest $var
     * @return $this
     */
    public function setAppEngineHttpRequest($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Tasks\V2beta3\AppEngineHttpRequest::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * `schedule_time` will be truncated to the nearest microsecond.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp schedule_time = 4;</code>
     * @return \Google\Protobuf\Timestamp
     */
    public function getScheduleTime()
    {
        return $this->schedule_time;
    }

    /**
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * `schedule_time` will be truncated to the nearest microsecond.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp schedule_time = 4;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setScheduleTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->schedule_time = $var;

        return $this;
    }

    /**
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 5;</code>
     * @return \Google\Protobuf\Timestamp
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    /**
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 5;</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. The number of attempts dispatched.
     * This count includes tasks which have been dispatched but haven't
     * received a response.
     *
     * Generated from protobuf field <code>int32 dispatch_count = 6;</code>
     * @return int
     */
    public function getDispatchCount()
    {
        return $this->dispatch_count;
    }

    /**
     * Output only. The number of attempts dispatched.
     * This count includes tasks which have been dispatched but haven't
     * received a response.
     *
     * Generated from protobuf field <code>int32 dispatch_count = 6;</code>
     * @param int $var
     * @return $this
     */
    public function setDispatchCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->dispatch_count = $var;

        return $this;
    }

    /**
     * Output only. The number of attempts which have received a response.
     *
     * Generated from protobuf field <code>int32 response_count = 7;</code>
     * @return int
     */
    public function getResponseCount()
    {
        return $this->response_count;
    }

    /**
     * Output only. The number of attempts which have received a response.
     *
     * Generated from protobuf field <code>int32 response_count = 7;</code>
     * @param int $var
     * @return $this
     */
    public function setResponseCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->response_count = $var;

        return $this;
    }

    /**
     * Output only. The status of the task's first attempt.
     * Only [dispatch_time][google.cloud.tasks.v2beta3.Attempt.dispatch_time] will be set.
     * The other [Attempt][google.cloud.tasks.v2beta3.Attempt] information is not retained by Cloud Tasks.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.Attempt first_attempt = 8;</code>
     * @return \Google\Cloud\Tasks\V2beta3\Attempt
     */
    public function getFirstAttempt()
    {
        return $this->first_attempt;
    }

    /**
     * Output only. The status of the task's first attempt.
     * Only [dispatch_time][google.cloud.tasks.v2beta3.Attempt.dispatch_time] will be set.
     * The other [Attempt][google.cloud.tasks.v2beta3.Attempt] information is not retained by Cloud Tasks.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.Attempt first_attempt = 8;</code>
     * @param \Google\Cloud\Tasks\V2beta3\Attempt $var
     * @return $this
     */
    public function setFirstAttempt($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Tasks\V2beta3\Attempt::class);
        $this->first_attempt = $var;

        return $this;
    }

    /**
     * Output only. The status of the task's last attempt.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.Attempt last_attempt = 9;</code>
     * @return \Google\Cloud\Tasks\V2beta3\Attempt
     */
    public function getLastAttempt()
    {
        return $this->last_attempt;
    }

    /**
     * Output only. The status of the task's last attempt.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.Attempt last_attempt = 9;</code>
     * @param \Google\Cloud\Tasks\V2beta3\Attempt $var
     * @return $this
     */
    public function setLastAttempt($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Tasks\V2beta3\Attempt::class);
        $this->last_attempt = $var;

        return $this;
    }

    /**
     * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] has
     * been returned.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.Task.View view = 10;</code>
     * @return int
     */
    public function getView()
    {
        return $this->view;
    }

    /**
     * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] has
     * been returned.
     *
     * Generated from protobuf field <code>.google.cloud.tasks.v2beta3.Task.View view = 10;</code>
     * @param int $var
     * @return $this
     */
    public function setView($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Tasks\V2beta3\Task_View::class);
        $this->view = $var;

        return $this;
    }

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

}

