<?php

namespace App\Services\Parsers;

use App\Contracts\HomepageParserInterface;

class VrtHomepageParserAdapter implements HomepageParserInterface
{
    public function __construct(
        private string $language = 'en',
    ) {}

    public function canParse(string $url): bool
    {
        return str_contains($url, 'vrt.be');
    }

    public function extractArticleUrls(string $html): array
    {
        return VrtHomepageParser::extractArticleUrls($html, $this->language);
    }

    public function getHomepageUrl(): string
    {
        return "https://www.vrt.be/vrtnws/{$this->language}/";
    }

    public function getSourceName(): string
    {
        return 'VRT News';
    }
}
