<?php

namespace App\Http\Controllers;

use App\Exports\OutAndAboutExport;
use Illuminate\Http\Response;
use Mtc\MercuryDataModels\ApiNotification;

class OutAndAboutController extends Controller
{
    public function stock(): Response
    {
        ApiNotification::query()->create([
            'provider' => 'out-and-about',
            'data' => request()->input(),
            'headers' => request()->header(),
            'processed' => true,
            'data_model' => 'vehicle',
        ]);

        return response((new OutAndAboutExport())->getExportData(), 200, ['Content-Type' => 'application/xml']);
    }
}
