<?php

namespace AC_SYNC\Includes\Classes\Async;

if (!defined('ABSPATH')) exit;

interface Action_Wear_Queue_Backend_Interface
{
    /**
     * @return int|false Inserted job ID or 0 if deduplicated, false on failure
     */
    public function push(
        string $jobType,
        ?array $payload = null,
        int $priority = 50,
        ?string $availableAt = null,
        ?string $conflictGroup = null,
        int $maxAttempts = 3,
        ?int $excludeJobId = null
    );

    public function pushProductImport(string $sku, ?array $productData = null): int;
    public function batchPushProductImport(array $skus): int;
    public function cancel(int $jobId): bool;
    public function cancelByType(string $jobType): int;
    public function hasPending(string $jobType, ?int $excludeJobId = null): bool;
    public function hasRunning(string $conflictGroup): bool;
    public function hasPendingJobs(): bool;
    public function countPending(): int;
    public function getJobs(array $filters = [], int $limit = 200): array;
    public function getJobCounts(): array;
    public function pruneCompleted(int $olderThanHours = 48): int;
    public function resetClaimed(): int;
    public function retryAllFailed(): int;
    public function retryJob(int $jobId): bool;
}
