<?php

namespace CpCreation\VitiCore\Bridge\Symfony\Bundle\Faker\Provider;

use CpCreation\VitiCore\Product\Model\ProductPriceGroup;
use CpCreation\VitiCore\Product\Model\ProductType;
use CpCreation\VitiCore\Product\Repository\ProductPriceGroupRepository;
use CpCreation\VitiCore\Product\Repository\ProductTypeRepository;
use Faker\Generator;
use Faker\Provider\Base as BaseProvider;

final class VitiCoreProvider extends BaseProvider
{
    public function __construct(
        Generator $generator,
        private readonly ProductPriceGroupRepository $productPriceGroupRepository,
        private readonly ProductTypeRepository $productTypeRepository,
    ) {
        parent::__construct($generator);
    }

    /**
     * @return ProductPriceGroup[]
     */
    public function groups(): array
    {
        return $this->productPriceGroupRepository->findAll();
    }

    /**
     * @return ProductType[]
     */
    public function getTypeBottle(): array
    {
        return $this->productTypeRepository->findBy([
            'equivalencyDefault' => true,
        ]);
    }
}
