<?php

namespace App\Twig\Extension;

use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class AppExtension extends AbstractExtension
{
    public function getFunctions(): array
    {
        return [
            new TwigFunction('get_placeholder', [$this, 'getPlaceholder']),
        ];
    }

    public function getPlaceholder(string $fieldName): string
    {
        return match ($fieldName) {
            'baseUrl' => 'https://example.com',
            'imageSelector' => '.manga-image img',
            'chapterUrlFormat' => 'https://example.com/manga/{slug}/chapter-{number}',
            'nextPageSelector' => '.next-page',
            'scrapingType' => 'Select scraping type',
            default => '',
        };
    }
}
