<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: keyapis/kms/v1/keyapis_kms_key_v1.proto

namespace Keyapis\Kms\V1\KeyInfo;

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

/**
 * Ошибка генерации
 *
 * Generated from protobuf message <code>keyapis.kms.v1.KeyInfo.GeneratingError</code>
 */
class GeneratingError extends \Google\Protobuf\Internal\Message
{
    protected $reason;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Keyapis\Kms\V1\KeyInfo\GeneratingError\TransactionError $transaction
     *           Ошибка генерации ключа в сервисе KMS
     *     @type \Keyapis\Kms\V1\KeyInfo\GeneratingError\PublishingKeyError $publishing
     *           Ошибка сохранения публичного ключа в сервисе JWKS
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Keyapis\Kms\V1\KeyapisKmsKeyV1::initOnce();
        parent::__construct($data);
    }

    /**
     * Ошибка генерации ключа в сервисе KMS
     *
     * Generated from protobuf field <code>.keyapis.kms.v1.KeyInfo.GeneratingError.TransactionError transaction = 1;</code>
     * @return \Keyapis\Kms\V1\KeyInfo\GeneratingError\TransactionError|null
     */
    public function getTransaction()
    {
        return $this->readOneof(1);
    }

    public function hasTransaction()
    {
        return $this->hasOneof(1);
    }

    /**
     * Ошибка генерации ключа в сервисе KMS
     *
     * Generated from protobuf field <code>.keyapis.kms.v1.KeyInfo.GeneratingError.TransactionError transaction = 1;</code>
     * @param \Keyapis\Kms\V1\KeyInfo\GeneratingError\TransactionError $var
     * @return $this
     */
    public function setTransaction($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Kms\V1\KeyInfo\GeneratingError\TransactionError::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Ошибка сохранения публичного ключа в сервисе JWKS
     *
     * Generated from protobuf field <code>.keyapis.kms.v1.KeyInfo.GeneratingError.PublishingKeyError publishing = 2;</code>
     * @return \Keyapis\Kms\V1\KeyInfo\GeneratingError\PublishingKeyError|null
     */
    public function getPublishing()
    {
        return $this->readOneof(2);
    }

    public function hasPublishing()
    {
        return $this->hasOneof(2);
    }

    /**
     * Ошибка сохранения публичного ключа в сервисе JWKS
     *
     * Generated from protobuf field <code>.keyapis.kms.v1.KeyInfo.GeneratingError.PublishingKeyError publishing = 2;</code>
     * @param \Keyapis\Kms\V1\KeyInfo\GeneratingError\PublishingKeyError $var
     * @return $this
     */
    public function setPublishing($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Kms\V1\KeyInfo\GeneratingError\PublishingKeyError::class);
        $this->writeOneof(2, $var);

        return $this;
    }

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

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GeneratingError::class, \Keyapis\Kms\V1\KeyInfo_GeneratingError::class);

