<?php

namespace endpoints\orders;

use traits\economic_endpoint_t;

class economic_invoices_pdf_endpoint
{
    use economic_endpoint_t;

    /**
     * Get a PDF of a booked invoice
     * @param int $id
     * @return string
     */
    public function get(int $id): string
    {
        $unique_id = uniqid();
        $this->send_file_download_request(
            '/invoices/booked/' . $id . '/pdf',
            'GET',
            '',
            false,
            '/tmp/invoice_' . $unique_id . '.pdf'
        );
        return '/tmp/invoice_' . $unique_id . '.pdf';
    }

}