<?php
namespace App\Components\Www;

use App\Repository\SponsorRepository;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;

#[AsTwigComponent(name: 'PartnersList', template: "www/components/partners-list.html.twig")]
class PartnersList
{
    public string $format = 'inline-footer';

    private SponsorRepository $sponsorRepository;

    public function __construct(SponsorRepository $sponsorRepository)
    {
        $this->sponsorRepository = $sponsorRepository;
    }

    public function getPartners(): array
    {
        // an example method that returns an array of Products
        return $this->sponsorRepository->findAllActive(true, false);
    }

    public function getClass(): string
    {
        switch ($this->format) {
            case 'inline-footer':
                return 'partners-list-inline-footer';
            default:
                return 'partners-list-inline-footer';
        }
    }
}