<?php

namespace domain\Config\TaxRate;

use domain\_\AbstractManager;

class TaxRateManager extends AbstractManager
{
    protected TaxRateBuilder $taxRateBuilder;

    public function loadDependencies(): void
    {
        $this->taxRateBuilder = $this->loadService(TaxRateBuilder::class);
    }

    public function createTaxRate(string $name, float $value): TaxRate
    {
        $taxRate = $this->taxRateBuilder->instanciateTaxRate();
        $taxRate->setName($name);
        $taxRate->setValue($value);
        $taxRate->save();
        return $taxRate;
    }
}