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

namespace Google\Cloud\Deploy\V1;

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

/**
 * Job represents an operation for a `Rollout`.
 *
 * Generated from protobuf message <code>google.cloud.deploy.v1.Job</code>
 */
class Job extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. The ID of the Job.
     *
     * Generated from protobuf field <code>string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $id = '';
    /**
     * Output only. The current state of the Job.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.Job.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $state = 0;
    /**
     * Output only. The name of the `JobRun` responsible for the most recent invocation of this
     * Job.
     *
     * Generated from protobuf field <code>string job_run = 3 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = {</code>
     */
    private $job_run = '';
    protected $job_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $id
     *           Output only. The ID of the Job.
     *     @type int $state
     *           Output only. The current state of the Job.
     *     @type string $job_run
     *           Output only. The name of the `JobRun` responsible for the most recent invocation of this
     *           Job.
     *     @type \Google\Cloud\Deploy\V1\DeployJob $deploy_job
     *           Output only. A deploy Job.
     *     @type \Google\Cloud\Deploy\V1\VerifyJob $verify_job
     *           Output only. A verify Job.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. The ID of the Job.
     *
     * Generated from protobuf field <code>string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Output only. The ID of the Job.
     *
     * Generated from protobuf field <code>string id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setId($var)
    {
        GPBUtil::checkString($var, True);
        $this->id = $var;

        return $this;
    }

    /**
     * Output only. The current state of the Job.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.Job.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * Output only. The current state of the Job.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.Job.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Deploy\V1\Job\State::class);
        $this->state = $var;

        return $this;
    }

    /**
     * Output only. The name of the `JobRun` responsible for the most recent invocation of this
     * Job.
     *
     * Generated from protobuf field <code>string job_run = 3 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getJobRun()
    {
        return $this->job_run;
    }

    /**
     * Output only. The name of the `JobRun` responsible for the most recent invocation of this
     * Job.
     *
     * Generated from protobuf field <code>string job_run = 3 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setJobRun($var)
    {
        GPBUtil::checkString($var, True);
        $this->job_run = $var;

        return $this;
    }

    /**
     * Output only. A deploy Job.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.DeployJob deploy_job = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Cloud\Deploy\V1\DeployJob|null
     */
    public function getDeployJob()
    {
        return $this->readOneof(4);
    }

    public function hasDeployJob()
    {
        return $this->hasOneof(4);
    }

    /**
     * Output only. A deploy Job.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.DeployJob deploy_job = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Cloud\Deploy\V1\DeployJob $var
     * @return $this
     */
    public function setDeployJob($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\DeployJob::class);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * Output only. A verify Job.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.VerifyJob verify_job = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Cloud\Deploy\V1\VerifyJob|null
     */
    public function getVerifyJob()
    {
        return $this->readOneof(5);
    }

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

    /**
     * Output only. A verify Job.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.VerifyJob verify_job = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Cloud\Deploy\V1\VerifyJob $var
     * @return $this
     */
    public function setVerifyJob($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\VerifyJob::class);
        $this->writeOneof(5, $var);

        return $this;
    }

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

}

