Weak hands cannot be planted, meager skills have no foundation. Shallow wisdom is futile, how can one hope for a good name?扰扰从役倦，屑屑身事微。少壮轻年月，迟暮惜光辉。
<html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><?php

namespace Hostinger\Admin\Jobs;

use Hostinger\LlmsTxtGenerator\LlmsTxtParser;

defined( 'ABSPATH' ) || exit;

abstract class AbstractBatchedJob extends AbstractJob {

    public function init(): void {
        add_action( $this->get_create_batch_hook(), array( $this, 'handle_create_batch_action' ), 10, 2 );
        parent::init();
    }

    protected function get_create_batch_hook(): string {
        return "{$this->get_hook_base_name()}create_batch";
    }

    public function schedule( array $args = array() ): void {
        $this->schedule_create_batch_action( 1, $args );
    }

    public function handle_create_batch_action( int $batch_number, array $args ): void {
        $items = $this->get_batch( $batch_number, $args );

        if ( empty( $items ) ) {
            $this->handle_complete( $batch_number, $args );
        } else {
            $this->schedule_process_action( $items, $args );
            $this->schedule_create_batch_action( $batch_number + 1, $args );
        }
    }

    protected function get_batch_size(): int {
        return apply_filters( 'hostinger_batch_item_limit', LlmsTxtParser::DEFAULT_LIMIT );
    }

    protected function get_query_offset( int $batch_number ): int {
        return $this->get_batch_size() * ( $batch_number - 1 );
    }

    protected function schedule_create_batch_action( int $batch_number, array $args ): void {
        if ( $this->can_schedule( array( $batch_number ) ) ) {
            $this->action_scheduler->schedule_immediate(
                $this->get_create_batch_hook(),
                array(
                    $batch_number,
                    $args,
                )
            );
        }
    }

    protected function schedule_process_action( array $items = array(), array $args = array() ): void {
        $job_data = array(
            'items' => $items,
            'ar