<?php

namespace Lc\CaracoleBundle\Factory\Ticket;

use Lc\CaracoleBundle\Context\MerchantContextTrait;
use Lc\CaracoleBundle\Context\SectionContextTrait;
use Lc\SovBundle\Factory\Ticket\TicketFactory as SovTicketFactory;
use Lc\SovBundle\Model\Ticket\TicketInterface;

class TicketFactory extends SovTicketFactory
{
    use SectionContextTrait;
    use MerchantContextTrait;

    public function create(): TicketInterface
    {
        $ticket = parent::create();

        if(isset($this->section) && !is_null($this->section)) {
            $ticket->setSection($this->section);
        }

        if(isset($this->merchant) && !is_null($this->merchant)) {
            $ticket->setMerchant($this->merchant);
        }

        return $ticket;
    }
}