<?php

namespace App\Listeners;

use App\Facades\Settings;
use App\Jobs\AutomaticallyMapColours;
use Illuminate\Foundation\Bus\DispatchesJobs;

class TriggerAutoColourMapping
{
    use DispatchesJobs;

    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  object  $event
     * @return void
     */
    public function handle($event)
    {
        if (Settings::get('filter-auto-map-colours')) {
            $this->dispatch(new AutomaticallyMapColours());
        }
    }
}
