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

namespace Keyapis\Subscription\V1;

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

/**
 * Коммерческая возможность(КВ)
 *
 * Generated from protobuf message <code>keyapis.subscription.v1.Offer</code>
 */
class Offer extends \Google\Protobuf\Internal\Message
{
    /**
     * Идентификатор
     *
     * Generated from protobuf field <code>int32 id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $id = 0;
    /**
     * Тип коммерческой возможности
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.Offer.Type type = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $type = 0;
    /**
     * ОРПОН.
     * Идентификатор дома
     *
     * Generated from protobuf field <code>int64 orpon = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $orpon = 0;
    /**
     * Идентификатор компании
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value company_id = 4;</code>
     */
    protected $company_id = null;
    /**
     * Идентификатор технологического плана
     *
     * Generated from protobuf field <code>int32 plan_id = 5 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $plan_id = 0;
    /**
     * Подключать ли автоматическую подписку
     *
     * Generated from protobuf field <code>bool is_enable_auto_subscribe = 6;</code>
     */
    protected $is_enable_auto_subscribe = false;
    /**
     * Тип статуса заказа
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.Offer.StatusType status_type = 7 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $status_type = 0;
    /**
     * Цена
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue price = 8;</code>
     */
    protected $price = null;
    /**
     * Признак принадлежности к цифровому пути
     *
     * Generated from protobuf field <code>bool is_digital_way = 9;</code>
     */
    protected $is_digital_way = false;
    /**
     * Дата создания записи.
     * Заполняется сервером
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp created_at = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $created_at = null;
    /**
     * Дата последнего изменения.
     * Заполняется и обновляется сервером.
     * Заполняется при создании и изменении.
     * Является версией объекта
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp changed_at = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $changed_at = null;
    /**
     * Адрес размещения офферты.
     * Полный url до файла
     *
     * Generated from protobuf field <code>.google.protobuf.StringValue offer_url = 12;</code>
     */
    protected $offer_url = null;
    /**
     * Снапшот состояния технологического плана на момент создания предложения.
     * В данный момент это ссылка в базе на запись, в будущем это будет снапшот
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.Plan plan = 13;</code>
     */
    protected $plan = null;
    /**
     * Цена по скидке
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue discount_price = 14;</code>
     */
    protected $discount_price = null;
    /**
     * Условия на скидку.
     * Если условий много то для срабатывания должны выполнять все условия
     *
     * Generated from protobuf field <code>repeated .keyapis.subscription.v1.Offer.DiscountRequirementType discount_requirement_types = 15;</code>
     */
    private $discount_requirement_types;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $id
     *           Идентификатор
     *     @type int $type
     *           Тип коммерческой возможности
     *     @type int|string $orpon
     *           ОРПОН.
     *           Идентификатор дома
     *     @type \Google\Protobuf\Int32Value $company_id
     *           Идентификатор компании
     *     @type int $plan_id
     *           Идентификатор технологического плана
     *     @type bool $is_enable_auto_subscribe
     *           Подключать ли автоматическую подписку
     *     @type int $status_type
     *           Тип статуса заказа
     *     @type \Google\Protobuf\DoubleValue $price
     *           Цена
     *     @type bool $is_digital_way
     *           Признак принадлежности к цифровому пути
     *     @type \Google\Protobuf\Timestamp $created_at
     *           Дата создания записи.
     *           Заполняется сервером
     *     @type \Google\Protobuf\Timestamp $changed_at
     *           Дата последнего изменения.
     *           Заполняется и обновляется сервером.
     *           Заполняется при создании и изменении.
     *           Является версией объекта
     *     @type \Google\Protobuf\StringValue $offer_url
     *           Адрес размещения офферты.
     *           Полный url до файла
     *     @type \Keyapis\Subscription\V1\Plan $plan
     *           Снапшот состояния технологического плана на момент создания предложения.
     *           В данный момент это ссылка в базе на запись, в будущем это будет снапшот
     *     @type \Google\Protobuf\DoubleValue $discount_price
     *           Цена по скидке
     *     @type array<int>|\Google\Protobuf\Internal\RepeatedField $discount_requirement_types
     *           Условия на скидку.
     *           Если условий много то для срабатывания должны выполнять все условия
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Keyapis\Subscription\V1\KeyapisSubscriptionOfferV1::initOnce();
        parent::__construct($data);
    }

    /**
     * Идентификатор
     *
     * Generated from protobuf field <code>int32 id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Идентификатор
     *
     * Generated from protobuf field <code>int32 id = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setId($var)
    {
        GPBUtil::checkInt32($var);
        $this->id = $var;

        return $this;
    }

    /**
     * Тип коммерческой возможности
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.Offer.Type type = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Тип коммерческой возможности
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.Offer.Type type = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setType($var)
    {
        GPBUtil::checkEnum($var, \Keyapis\Subscription\V1\Offer\Type::class);
        $this->type = $var;

        return $this;
    }

    /**
     * ОРПОН.
     * Идентификатор дома
     *
     * Generated from protobuf field <code>int64 orpon = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int|string
     */
    public function getOrpon()
    {
        return $this->orpon;
    }

    /**
     * ОРПОН.
     * Идентификатор дома
     *
     * Generated from protobuf field <code>int64 orpon = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int|string $var
     * @return $this
     */
    public function setOrpon($var)
    {
        GPBUtil::checkInt64($var);
        $this->orpon = $var;

        return $this;
    }

    /**
     * Идентификатор компании
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value company_id = 4;</code>
     * @return \Google\Protobuf\Int32Value|null
     */
    public function getCompanyId()
    {
        return $this->company_id;
    }

    public function hasCompanyId()
    {
        return isset($this->company_id);
    }

    public function clearCompanyId()
    {
        unset($this->company_id);
    }

    /**
     * Returns the unboxed value from <code>getCompanyId()</code>

     * Идентификатор компании
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value company_id = 4;</code>
     * @return int|null
     */
    public function getCompanyIdUnwrapped()
    {
        return $this->readWrapperValue("company_id");
    }

    /**
     * Идентификатор компании
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value company_id = 4;</code>
     * @param \Google\Protobuf\Int32Value $var
     * @return $this
     */
    public function setCompanyId($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Int32Value::class);
        $this->company_id = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object.

     * Идентификатор компании
     *
     * Generated from protobuf field <code>.google.protobuf.Int32Value company_id = 4;</code>
     * @param int|null $var
     * @return $this
     */
    public function setCompanyIdUnwrapped($var)
    {
        $this->writeWrapperValue("company_id", $var);
        return $this;}

    /**
     * Идентификатор технологического плана
     *
     * Generated from protobuf field <code>int32 plan_id = 5 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getPlanId()
    {
        return $this->plan_id;
    }

    /**
     * Идентификатор технологического плана
     *
     * Generated from protobuf field <code>int32 plan_id = 5 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setPlanId($var)
    {
        GPBUtil::checkInt32($var);
        $this->plan_id = $var;

        return $this;
    }

    /**
     * Подключать ли автоматическую подписку
     *
     * Generated from protobuf field <code>bool is_enable_auto_subscribe = 6;</code>
     * @return bool
     */
    public function getIsEnableAutoSubscribe()
    {
        return $this->is_enable_auto_subscribe;
    }

    /**
     * Подключать ли автоматическую подписку
     *
     * Generated from protobuf field <code>bool is_enable_auto_subscribe = 6;</code>
     * @param bool $var
     * @return $this
     */
    public function setIsEnableAutoSubscribe($var)
    {
        GPBUtil::checkBool($var);
        $this->is_enable_auto_subscribe = $var;

        return $this;
    }

    /**
     * Тип статуса заказа
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.Offer.StatusType status_type = 7 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getStatusType()
    {
        return $this->status_type;
    }

    /**
     * Тип статуса заказа
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.Offer.StatusType status_type = 7 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setStatusType($var)
    {
        GPBUtil::checkEnum($var, \Keyapis\Subscription\V1\Offer\StatusType::class);
        $this->status_type = $var;

        return $this;
    }

    /**
     * Цена
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue price = 8;</code>
     * @return \Google\Protobuf\DoubleValue|null
     */
    public function getPrice()
    {
        return $this->price;
    }

    public function hasPrice()
    {
        return isset($this->price);
    }

    public function clearPrice()
    {
        unset($this->price);
    }

    /**
     * Returns the unboxed value from <code>getPrice()</code>

     * Цена
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue price = 8;</code>
     * @return float|null
     */
    public function getPriceUnwrapped()
    {
        return $this->readWrapperValue("price");
    }

    /**
     * Цена
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue price = 8;</code>
     * @param \Google\Protobuf\DoubleValue $var
     * @return $this
     */
    public function setPrice($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\DoubleValue::class);
        $this->price = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\DoubleValue object.

     * Цена
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue price = 8;</code>
     * @param float|null $var
     * @return $this
     */
    public function setPriceUnwrapped($var)
    {
        $this->writeWrapperValue("price", $var);
        return $this;}

    /**
     * Признак принадлежности к цифровому пути
     *
     * Generated from protobuf field <code>bool is_digital_way = 9;</code>
     * @return bool
     */
    public function getIsDigitalWay()
    {
        return $this->is_digital_way;
    }

    /**
     * Признак принадлежности к цифровому пути
     *
     * Generated from protobuf field <code>bool is_digital_way = 9;</code>
     * @param bool $var
     * @return $this
     */
    public function setIsDigitalWay($var)
    {
        GPBUtil::checkBool($var);
        $this->is_digital_way = $var;

        return $this;
    }

    /**
     * Дата создания записи.
     * Заполняется сервером
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp created_at = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreatedAt()
    {
        return $this->created_at;
    }

    public function hasCreatedAt()
    {
        return isset($this->created_at);
    }

    public function clearCreatedAt()
    {
        unset($this->created_at);
    }

    /**
     * Дата создания записи.
     * Заполняется сервером
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp created_at = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreatedAt($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->created_at = $var;

        return $this;
    }

    /**
     * Дата последнего изменения.
     * Заполняется и обновляется сервером.
     * Заполняется при создании и изменении.
     * Является версией объекта
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp changed_at = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getChangedAt()
    {
        return $this->changed_at;
    }

    public function hasChangedAt()
    {
        return isset($this->changed_at);
    }

    public function clearChangedAt()
    {
        unset($this->changed_at);
    }

    /**
     * Дата последнего изменения.
     * Заполняется и обновляется сервером.
     * Заполняется при создании и изменении.
     * Является версией объекта
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp changed_at = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setChangedAt($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->changed_at = $var;

        return $this;
    }

    /**
     * Адрес размещения офферты.
     * Полный url до файла
     *
     * Generated from protobuf field <code>.google.protobuf.StringValue offer_url = 12;</code>
     * @return \Google\Protobuf\StringValue|null
     */
    public function getOfferUrl()
    {
        return $this->offer_url;
    }

    public function hasOfferUrl()
    {
        return isset($this->offer_url);
    }

    public function clearOfferUrl()
    {
        unset($this->offer_url);
    }

    /**
     * Returns the unboxed value from <code>getOfferUrl()</code>

     * Адрес размещения офферты.
     * Полный url до файла
     *
     * Generated from protobuf field <code>.google.protobuf.StringValue offer_url = 12;</code>
     * @return string|null
     */
    public function getOfferUrlUnwrapped()
    {
        return $this->readWrapperValue("offer_url");
    }

    /**
     * Адрес размещения офферты.
     * Полный url до файла
     *
     * Generated from protobuf field <code>.google.protobuf.StringValue offer_url = 12;</code>
     * @param \Google\Protobuf\StringValue $var
     * @return $this
     */
    public function setOfferUrl($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\StringValue::class);
        $this->offer_url = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\StringValue object.

     * Адрес размещения офферты.
     * Полный url до файла
     *
     * Generated from protobuf field <code>.google.protobuf.StringValue offer_url = 12;</code>
     * @param string|null $var
     * @return $this
     */
    public function setOfferUrlUnwrapped($var)
    {
        $this->writeWrapperValue("offer_url", $var);
        return $this;}

    /**
     * Снапшот состояния технологического плана на момент создания предложения.
     * В данный момент это ссылка в базе на запись, в будущем это будет снапшот
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.Plan plan = 13;</code>
     * @return \Keyapis\Subscription\V1\Plan|null
     */
    public function getPlan()
    {
        return $this->plan;
    }

    public function hasPlan()
    {
        return isset($this->plan);
    }

    public function clearPlan()
    {
        unset($this->plan);
    }

    /**
     * Снапшот состояния технологического плана на момент создания предложения.
     * В данный момент это ссылка в базе на запись, в будущем это будет снапшот
     *
     * Generated from protobuf field <code>.keyapis.subscription.v1.Plan plan = 13;</code>
     * @param \Keyapis\Subscription\V1\Plan $var
     * @return $this
     */
    public function setPlan($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Subscription\V1\Plan::class);
        $this->plan = $var;

        return $this;
    }

    /**
     * Цена по скидке
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue discount_price = 14;</code>
     * @return \Google\Protobuf\DoubleValue|null
     */
    public function getDiscountPrice()
    {
        return $this->discount_price;
    }

    public function hasDiscountPrice()
    {
        return isset($this->discount_price);
    }

    public function clearDiscountPrice()
    {
        unset($this->discount_price);
    }

    /**
     * Returns the unboxed value from <code>getDiscountPrice()</code>

     * Цена по скидке
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue discount_price = 14;</code>
     * @return float|null
     */
    public function getDiscountPriceUnwrapped()
    {
        return $this->readWrapperValue("discount_price");
    }

    /**
     * Цена по скидке
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue discount_price = 14;</code>
     * @param \Google\Protobuf\DoubleValue $var
     * @return $this
     */
    public function setDiscountPrice($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\DoubleValue::class);
        $this->discount_price = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\DoubleValue object.

     * Цена по скидке
     *
     * Generated from protobuf field <code>.google.protobuf.DoubleValue discount_price = 14;</code>
     * @param float|null $var
     * @return $this
     */
    public function setDiscountPriceUnwrapped($var)
    {
        $this->writeWrapperValue("discount_price", $var);
        return $this;}

    /**
     * Условия на скидку.
     * Если условий много то для срабатывания должны выполнять все условия
     *
     * Generated from protobuf field <code>repeated .keyapis.subscription.v1.Offer.DiscountRequirementType discount_requirement_types = 15;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getDiscountRequirementTypes()
    {
        return $this->discount_requirement_types;
    }

    /**
     * Условия на скидку.
     * Если условий много то для срабатывания должны выполнять все условия
     *
     * Generated from protobuf field <code>repeated .keyapis.subscription.v1.Offer.DiscountRequirementType discount_requirement_types = 15;</code>
     * @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setDiscountRequirementTypes($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Keyapis\Subscription\V1\Offer\DiscountRequirementType::class);
        $this->discount_requirement_types = $arr;

        return $this;
    }

}

