<?php

namespace App\Listeners;

use App\Modules\Stock\CustomEndpoint;

class AddCustomEndpointDealershipFields
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct(private readonly CustomEndpoint $endpoint)
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  object  $event
     * @return array
     */
    public function handle($event)
    {
        if ($this->endpoint->enabled() === false) {
            return [];
        }
        return $this->endpoint->dealershipAdditionalDataFields();
    }
}
