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

namespace Keyapis\Subscription\V1\OfferTemplate;

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

/**
 * Ошибка сохранения.
 * Эти проверки выполняются при работе с базой данных и сторонними сервисами
 *
 * Generated from protobuf message <code>keyapis.subscription.v1.OfferTemplate.SavingError</code>
 */
class SavingError extends \Google\Protobuf\Internal\Message
{
    protected $reason;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Keyapis\Subscription\V1\OfferTemplate\SavingError\Conflict $conflict
     *           Конфликт версий
     *     @type \Keyapis\Subscription\V1\OfferTemplate\SavingError\DuplicateTemplate $duplicate_template
     *           Дублирование шаблона
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Keyapis\Subscription\V1\KeyapisSubscriptionOfferTemplateV1::initOnce();
        parent::__construct($data);
    }

    /**
     * Конфликт версий
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.OfferTemplate.SavingError.Conflict conflict = 1;</code>
     * @return \Keyapis\Subscription\V1\OfferTemplate\SavingError\Conflict|null
     */
    public function getConflict()
    {
        return $this->readOneof(1);
    }

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

    /**
     * Конфликт версий
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.OfferTemplate.SavingError.Conflict conflict = 1;</code>
     * @param \Keyapis\Subscription\V1\OfferTemplate\SavingError\Conflict $var
     * @return $this
     */
    public function setConflict($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Subscription\V1\OfferTemplate\SavingError\Conflict::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Дублирование шаблона
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.OfferTemplate.SavingError.DuplicateTemplate duplicate_template = 2;</code>
     * @return \Keyapis\Subscription\V1\OfferTemplate\SavingError\DuplicateTemplate|null
     */
    public function getDuplicateTemplate()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Дублирование шаблона
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.OfferTemplate.SavingError.DuplicateTemplate duplicate_template = 2;</code>
     * @param \Keyapis\Subscription\V1\OfferTemplate\SavingError\DuplicateTemplate $var
     * @return $this
     */
    public function setDuplicateTemplate($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Subscription\V1\OfferTemplate\SavingError\DuplicateTemplate::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(SavingError::class, \Keyapis\Subscription\V1\OfferTemplate_SavingError::class);

