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

namespace Google\Cloud\DocumentAI\V1;

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

/**
 * The common metadata for long running operations.
 *
 * Generated from protobuf message <code>google.cloud.documentai.v1.CommonOperationMetadata</code>
 */
class CommonOperationMetadata extends \Google\Protobuf\Internal\Message
{
    /**
     * The state of the operation.
     *
     * Generated from protobuf field <code>.google.cloud.documentai.v1.CommonOperationMetadata.State state = 1;</code>
     */
    private $state = 0;
    /**
     * A message providing more details about the current state of processing.
     *
     * Generated from protobuf field <code>string state_message = 2;</code>
     */
    private $state_message = '';
    /**
     * A related resource to this operation.
     *
     * Generated from protobuf field <code>string resource = 5;</code>
     */
    private $resource = '';
    /**
     * The creation time of the operation.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</code>
     */
    private $create_time = null;
    /**
     * The last update time of the operation.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 4;</code>
     */
    private $update_time = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $state
     *           The state of the operation.
     *     @type string $state_message
     *           A message providing more details about the current state of processing.
     *     @type string $resource
     *           A related resource to this operation.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           The creation time of the operation.
     *     @type \Google\Protobuf\Timestamp $update_time
     *           The last update time of the operation.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Documentai\V1\OperationMetadata::initOnce();
        parent::__construct($data);
    }

    /**
     * The state of the operation.
     *
     * Generated from protobuf field <code>.google.cloud.documentai.v1.CommonOperationMetadata.State state = 1;</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * The state of the operation.
     *
     * Generated from protobuf field <code>.google.cloud.documentai.v1.CommonOperationMetadata.State state = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata\State::class);
        $this->state = $var;

        return $this;
    }

    /**
     * A message providing more details about the current state of processing.
     *
     * Generated from protobuf field <code>string state_message = 2;</code>
     * @return string
     */
    public function getStateMessage()
    {
        return $this->state_message;
    }

    /**
     * A message providing more details about the current state of processing.
     *
     * Generated from protobuf field <code>string state_message = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setStateMessage($var)
    {
        GPBUtil::checkString($var, True);
        $this->state_message = $var;

        return $this;
    }

    /**
     * A related resource to this operation.
     *
     * Generated from protobuf field <code>string resource = 5;</code>
     * @return string
     */
    public function getResource()
    {
        return $this->resource;
    }

    /**
     * A related resource to this operation.
     *
     * Generated from protobuf field <code>string resource = 5;</code>
     * @param string $var
     * @return $this
     */
    public function setResource($var)
    {
        GPBUtil::checkString($var, True);
        $this->resource = $var;

        return $this;
    }

    /**
     * The creation time of the operation.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    public function hasCreateTime()
    {
        return isset($this->create_time);
    }

    public function clearCreateTime()
    {
        unset($this->create_time);
    }

    /**
     * The creation time of the operation.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</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;
    }

    /**
     * The last update time of the operation.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 4;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getUpdateTime()
    {
        return $this->update_time;
    }

    public function hasUpdateTime()
    {
        return isset($this->update_time);
    }

    public function clearUpdateTime()
    {
        unset($this->update_time);
    }

    /**
     * The last update time of the operation.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 4;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setUpdateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->update_time = $var;

        return $this;
    }

}

