<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/run/v2/condition.proto

namespace Google\Cloud\Run\V2;

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

/**
 * Defines a status condition for a resource.
 *
 * Generated from protobuf message <code>google.cloud.run.v2.Condition</code>
 */
class Condition extends \Google\Protobuf\Internal\Message
{
    /**
     * type is used to communicate the status of the reconciliation process.
     * See also:
     * https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting
     * Types common to all resources include:
     * * "Ready": True when the Resource is ready.
     *
     * Generated from protobuf field <code>string type = 1;</code>
     */
    private $type = '';
    /**
     * State of the condition.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.State state = 2;</code>
     */
    private $state = 0;
    /**
     * Human readable message indicating details about the current status.
     *
     * Generated from protobuf field <code>string message = 3;</code>
     */
    private $message = '';
    /**
     * Last time the condition transitioned from one status to another.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_transition_time = 4;</code>
     */
    private $last_transition_time = null;
    /**
     * How to interpret failures of this condition, one of Error, Warning, Info
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.Severity severity = 5;</code>
     */
    private $severity = 0;
    protected $reasons;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $type
     *           type is used to communicate the status of the reconciliation process.
     *           See also:
     *           https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting
     *           Types common to all resources include:
     *           * "Ready": True when the Resource is ready.
     *     @type int $state
     *           State of the condition.
     *     @type string $message
     *           Human readable message indicating details about the current status.
     *     @type \Google\Protobuf\Timestamp $last_transition_time
     *           Last time the condition transitioned from one status to another.
     *     @type int $severity
     *           How to interpret failures of this condition, one of Error, Warning, Info
     *     @type int $reason
     *           A common (service-level) reason for this condition.
     *     @type int $revision_reason
     *           A reason for the revision condition.
     *     @type int $execution_reason
     *           A reason for the execution condition.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Run\V2\Condition::initOnce();
        parent::__construct($data);
    }

    /**
     * type is used to communicate the status of the reconciliation process.
     * See also:
     * https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting
     * Types common to all resources include:
     * * "Ready": True when the Resource is ready.
     *
     * Generated from protobuf field <code>string type = 1;</code>
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * type is used to communicate the status of the reconciliation process.
     * See also:
     * https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting
     * Types common to all resources include:
     * * "Ready": True when the Resource is ready.
     *
     * Generated from protobuf field <code>string type = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setType($var)
    {
        GPBUtil::checkString($var, True);
        $this->type = $var;

        return $this;
    }

    /**
     * State of the condition.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.State state = 2;</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * State of the condition.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.State state = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Run\V2\Condition\State::class);
        $this->state = $var;

        return $this;
    }

    /**
     * Human readable message indicating details about the current status.
     *
     * Generated from protobuf field <code>string message = 3;</code>
     * @return string
     */
    public function getMessage()
    {
        return $this->message;
    }

    /**
     * Human readable message indicating details about the current status.
     *
     * Generated from protobuf field <code>string message = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setMessage($var)
    {
        GPBUtil::checkString($var, True);
        $this->message = $var;

        return $this;
    }

    /**
     * Last time the condition transitioned from one status to another.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_transition_time = 4;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getLastTransitionTime()
    {
        return $this->last_transition_time;
    }

    public function hasLastTransitionTime()
    {
        return isset($this->last_transition_time);
    }

    public function clearLastTransitionTime()
    {
        unset($this->last_transition_time);
    }

    /**
     * Last time the condition transitioned from one status to another.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_transition_time = 4;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setLastTransitionTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->last_transition_time = $var;

        return $this;
    }

    /**
     * How to interpret failures of this condition, one of Error, Warning, Info
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.Severity severity = 5;</code>
     * @return int
     */
    public function getSeverity()
    {
        return $this->severity;
    }

    /**
     * How to interpret failures of this condition, one of Error, Warning, Info
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.Severity severity = 5;</code>
     * @param int $var
     * @return $this
     */
    public function setSeverity($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Run\V2\Condition\Severity::class);
        $this->severity = $var;

        return $this;
    }

    /**
     * A common (service-level) reason for this condition.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.CommonReason reason = 6;</code>
     * @return int
     */
    public function getReason()
    {
        return $this->readOneof(6);
    }

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

    /**
     * A common (service-level) reason for this condition.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.CommonReason reason = 6;</code>
     * @param int $var
     * @return $this
     */
    public function setReason($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Run\V2\Condition\CommonReason::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * A reason for the revision condition.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.RevisionReason revision_reason = 9;</code>
     * @return int
     */
    public function getRevisionReason()
    {
        return $this->readOneof(9);
    }

    public function hasRevisionReason()
    {
        return $this->hasOneof(9);
    }

    /**
     * A reason for the revision condition.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.RevisionReason revision_reason = 9;</code>
     * @param int $var
     * @return $this
     */
    public function setRevisionReason($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Run\V2\Condition\RevisionReason::class);
        $this->writeOneof(9, $var);

        return $this;
    }

    /**
     * A reason for the execution condition.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.ExecutionReason execution_reason = 11;</code>
     * @return int
     */
    public function getExecutionReason()
    {
        return $this->readOneof(11);
    }

    public function hasExecutionReason()
    {
        return $this->hasOneof(11);
    }

    /**
     * A reason for the execution condition.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Condition.ExecutionReason execution_reason = 11;</code>
     * @param int $var
     * @return $this
     */
    public function setExecutionReason($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Run\V2\Condition\ExecutionReason::class);
        $this->writeOneof(11, $var);

        return $this;
    }

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

}

