<?php

namespace KupShop\OrderingBundle\Attachment;

use KupShop\KupShopBundle\Email\EmailGroupTypeEnum;
use KupShop\OrderingBundle\Util\Invoice\PdfGenerator;

class DeliveryNotePDFAttachment extends BaseAttachment
{
    protected static $name = 'Dodací list';
    protected static $type = 'order_delivery_note';
    protected static $group = EmailGroupTypeEnum::ORDER;

    protected $filename = 'DodaciList_{KOD}.pdf';
    protected $template = 'invoiceDodak';

    private $pdfGenerator;

    public function __construct(PdfGenerator $pdfGenerator)
    {
        $this->pdfGenerator = $pdfGenerator;
    }

    public function getFilename(): string
    {
        return $this->order->replacePlaceholders(translate_shop('delivery_note_filename', 'attachments'));
    }

    public function getContent()
    {
        return $this->pdfGenerator->setTemplate($this->getTemplate())->getInvoicePDFContent($this->order->id);
    }
}
