<?php

namespace Lc\SovBundle\Factory\Ticket;

use Lc\SovBundle\Container\Ticket\TicketContainer;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Model\Ticket\TicketModel;

class TicketFactory extends AbstractFactory implements TicketFactoryInterface
{
    public function create(): TicketInterface
    {
        $class = TicketContainer::getEntityFqcn();
        $ticket = new $class;

        $ticketMessageFactory = new TicketMessageFactory();
        $ticketMessage = $ticketMessageFactory->create($ticket) ;

        $ticket->setStatus(TicketModel::TICKET_STATUS_OPEN);
        $ticket->addTicketMessage($ticketMessage) ;

        return $ticket;
    }
}
