<?php

namespace common\logic\Feature\Feature;

use common\logic\AbstractManager;
use common\logic\Feature\FeatureProducer\FeatureProducerBuilder;

class FeatureManager extends AbstractManager
{
    protected FeatureBuilder $featureBuilder;
    protected FeatureProducerBuilder $featureProducerBuilder;

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

    public function enableFeature(Feature $feature): void
    {
        $this->featureBuilder->updateStatus($feature, true);
    }

    public function disableFeature(Feature $feature): void
    {
        $this->featureBuilder->updateStatus($feature, false);
    }

    public function enableFeatureForProducer(Feature $feature)
    {
        $this->featureProducerBuilder->updateStatusByFeature($feature, true);
    }

    public function disableFeatureForProducer(Feature $feature)
    {
        $this->featureProducerBuilder->updateStatusByFeature($feature, false);
    }

    public function defaultFeatureForProducer(Feature $feature)
    {
        $this->featureProducerBuilder->updateStatusByFeature($feature, null);
    }
}