<?php

namespace RtmMail\AjaxAction;

use RtmMail\Actions\Handlers\DeleteMultipleLogsAction;

class DeleteMultipleAjaxAction
{

    public function __construct()
    {
    }

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