<?php
namespace App\Components\Www;

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

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

    private SponsorRepository $sponsorRepository;

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

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

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