<?php
declare(strict_types=1);

namespace Autogedal\Manufacturers\Setup\Patch\Data;

use Autogedal\Manufacturers\Service\CommonBlockManager;
use Autogedal\Manufacturers\Service\ManufacturerGenerator;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\NonTransactionableInterface;

class SyncManufacturerPages implements DataPatchInterface, NonTransactionableInterface
{
    public function __construct(
        private readonly CommonBlockManager $commonBlockManager,
        private readonly ManufacturerGenerator $manufacturerGenerator
    ) {
    }

    public function apply(): self
    {
        $this->commonBlockManager->ensureExists();
        $this->manufacturerGenerator->generate();

        return $this;
    }

    public static function getDependencies(): array
    {
        return [SeedInactiveManufacturers::class];
    }

    public function getAliases(): array
    {
        return [];
    }
}
