<?php

declare(strict_types=1);

namespace apexl\Io\modules\tabulator\Request;

use apexl\Io\Request\IoRequest;

final class TabulatorAjaxRequest extends IoRequest
{
    private const string QUERY__DATA = 'data';
    private const string QUERY__FIELD = 'field';

    public function field(): string
    {
        return $this->query(self::QUERY__FIELD, '');
    }

    public function data(): array
    {
        return json_decode($this->query(self::QUERY__DATA, '[]'), true) ?: [];
    }
}
