<?php

namespace RtmMail\AjaxAction;

use RtmMail\Actions\Handlers\DeleteLogAction;

class DeleteLogAjaxAction
{

    public function __construct()
    {
    }

    public function handleAction(): void
    {
        if (empty($_POST['log_id'])) {
            wp_send_json_error(['message'=>'missing required variable']);
        }
        $context = $_POST['context'] ?? 'default_context';
        $action = new DeleteLogAction($context);
        $handle_action = $action->handleAction($_POST['log_id']);
        wp_send_json($handle_action);
    }
}
