<?php

namespace common\logic\Feature\Feature;

use common\logic\AbstractManager;

class FeatureImporter extends AbstractManager
{
    protected FeatureDefinition $featureDefinition;
    protected FeatureBuilder $featureBuilder;

    public function loadDependencies(): void
    {
        $this->featureDefinition = $this->loadService(FeatureDefinition::class);
        $this->featureBuilder = $this->loadService(FeatureBuilder::class);
    }

    public function importFromDefinition()
    {
        $featuresBaseArray = $this->featureDefinition->getFeaturesBase();

        foreach($featuresBaseArray as $alias => $featureBaseName) {
            $this->featureBuilder->createFeature(
                $alias,
                $featureBaseName
            );
        }
    }
}