<?php

declare(strict_types=1);

namespace CliqThemes\StoreLocator\Markers;

defined('ABSPATH') || exit;

use CliqThemes\StoreLocator\Models\Store;

/**
 * One marker image for the whole map, chosen from the packaged set in Settings.
 *
 * Every store answers the same, so there is nothing to pre-load and no design
 * to offer. Resolved once per request.
 */
final class BundledMarkers implements MarkerSource
{
    /** @var array{icon_url: string, width: int, height: int}|null */
    private ?array $marker = null;

    /** @param int[] $storeIds */
    public function prefetch(array $storeIds): void
    {
        // Nothing to batch: the answer does not depend on the store.
    }

    /** @return array{icon_url: string, width: int, height: int}|null */
    public function imageFor(Store $store): ?array
    {
        return $this->marker ??= (new BundledMarkerResolver())->resolve();
    }

    public function designIdFor(Store $store): int
    {
        return 0;
    }
}
