<?php

namespace KupShop\CatalogBundle\Entity\Wrapper;

use KupShop\CatalogBundle\Entity\Product\ProductPricesResult;
use KupShop\KupShopBundle\Template\ObjectWrapper;
use KupShop\KupShopBundle\Wrapper\PriceWrapper;

/**
 * @property ProductPricesResult $object
 *
 * @method static ProductPricesResult unwrap($object)
 */
class ProductPricesResultWrapper extends ObjectWrapper
{
    protected static $objectType = ProductPricesResult::class;

    public function field_price(): PriceWrapper
    {
        return PriceWrapper::wrap($this->object->getPrice());
    }

    public function field_retailPrice(): ?PriceWrapper
    {
        return $this->object->getRetailPrice() ? PriceWrapper::wrap($this->object->getRetailPrice()) : null;
    }

    public function field_originalPrice(): ?PriceWrapper
    {
        return $this->object->getOriginalPrice() ? PriceWrapper::wrap($this->object->getOriginalPrice()) : null;
    }

    public function field_discount(): \Decimal
    {
        return $this->object->getDiscount();
    }

    // BC layer
    public function field_priceOriginal(): ?PriceWrapper
    {
        return $this->field_originalPrice();
    }
}
