<?php

namespace iwbvel\classes\services\background_process\handlers;

defined('ABSPATH') || exit(); // Exit if accessed directly

class VariationDeleteHandler implements HandlerInterface
{
    public function handle($item)
    {
        if (empty($item['variable_id']) || !isset($item['delete_class']) || empty($item['delete_data'])) {
            return;
        }

        $item['delete_data']['background_process'] = true;
        $instance = new $item['delete_class']();
        $instance->update([intval($item['variable_id'])], $item['delete_data']);
    }
}
