<?php
/**
 * Form Renderer
 *
 * @author Elze Kool <info@visualmedia.nl>
 */

namespace VisualM\FormBundle\Renderer;

use Symfony\Component\Templating\EngineInterface;
use VisualM\FormBundle\Entity\Form as FormEntity;

/**
 * Email Renderer
 *
 * @author Elze Kool <info@visualmedia.nl>
 */
class EmailRenderer
{
    /**
     * Templating Engine
     * @var EngineInterface
     */
    private $templating;
    
    /**
     * Constructor
     *
     * @Param EngineInterface $templating Templating Engine
     */
    public function __construct(EngineInterface $templating)
    {
        $this->templating = $templating;
    }

    /**
     * Render E-mail
     *
     * @param FormEntity $formEntity Form Entity
     * @param array      $data       Data
     *
     * @return string E-mail HTML
     */
    public function renderEmail(FormEntity $formEntity, array $data)
    {
         // Create message HTML
        return $this->templating->render(sprintf('VisualMFormEntity~%d~emailHtml', $formEntity->getId()), [
            'form' => $formEntity,
            'data' => $data
        ]);
    }

    /**
     * Render kopie E-mail
     *
     * @param FormEntity $formEntity Form Entity
     * @param array      $data       Data
     *
     * @return string E-mail HTML
     */
    public function renderKopieEmail(FormEntity $formEntity, array $data)
    {
         // Create message HTML
        return $this->templating->render(sprintf('VisualMFormEntity~%d~kopieEmailHtml', $formEntity->getId()), [
            'form' => $formEntity,
            'data' => $data
        ]);
    }

}