<?php

//Created with PHPStorm AI

use Silvanus\includes\blocks\AcfBlockFields;

try {
    $fields = new AcfBlockFields('Logo Slider', __FILE__);

    $fields->addContainerSettings();

    $fields->addText('title', [
        'default_value' => '',
    ]);

    $fields->addNumber('images visible', [
        'default_value' => '',
        'min' => 1,
        'max' => 12,
        'step' => 1,
        'required' => 0,
        'instructions' => 'Optional. If set, forces a fixed number of slides visible at once. If blank, slides size naturally.',
    ]);

    $fields->addNumber('slider speed', [
        'default_value' => 35,
        'min' => 0,
        'step' => 5,
        'instructions' => 'Autoplay speed in pixels per second. 0 disables autoplay. Typical values: 20–80',
    ]);

    $fields->addTrueFalse('pause on hover', [
        'default_value' => 1,
        'ui' => 1,
        'instructions' => 'Pause autoplay when the user hovers the slider.',
    ]);

    $fields->addRepeater('images', [
        'layout' => 'block',
        'button_label' => 'Add Logo',
        'min' => 1,
    ])
        ->addImage('image', [
            'return_format' => 'id',
            'preview_size' => 'medium',
            'library' => 'all',
            'mime_types' => 'png,jpg,jpeg,svg,webp',
            'instructions' => 'Upload a PNG, JPG, SVG, or WebP logo.',
        ])
        ->addLink('link', [
            'return_format' => 'array',
            'instructions' => 'Optional. If set, the logo becomes clickable.',
        ])
        ->endRepeater();

    return $fields->build();
} catch (\StoutLogic\AcfBuilder\FieldNameCollisionException $e) {
    // no-op
}