<?php

namespace Lc\CaracoleBundle\Factory\Order;

use App\Entity\Order\OrderReductionCart;
use Lc\CaracoleBundle\Model\Order\OrderReductionCartInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface;
use Lc\SovBundle\Factory\AbstractFactory;

class OrderReductionCartFactory extends AbstractFactory
{
    // createOrderReductionCart
    public function create(OrderShopInterface $orderShop, ReductionCartInterface $reductionCart, $code = null): OrderReductionCartInterface
    {
        $orderReductionCart = new OrderReductionCart();

        $orderReductionCart->setOrderShop($orderShop);
        $orderReductionCart->setReductionCart($reductionCart);
        $orderReductionCart->setTitle($reductionCart->getTitle());
        $orderReductionCart->setValue($reductionCart->getValue());
        $orderReductionCart->setUnit($reductionCart->getUnit());
        $orderReductionCart->setBehaviorTaxRate($reductionCart->getBehaviorTaxRate());
        $orderReductionCart->setFreeShipping($reductionCart->getFreeShipping());
        $orderReductionCart->setAppliedTo($reductionCart->getAppliedTo());
        $orderReductionCart->setType($reductionCart->getType());
        $orderReductionCart->setCodeUsed($code);

        return $orderReductionCart;
    }

}