<?php

declare(strict_types=1);

namespace apexl\Io\factories;

use apexl\Io\includes\Entity;
use apexl\Io\services\LoaderArgumentResolver;
use Arrayy\Type\StringCollection;
use DI\Container;
use DI\DependencyException;
use DI\NotFoundException;

final readonly class LoaderArgumentResolverFactory
{
    public function __construct(
        private Container $container,
    ) {}

    /**
     * @throws DependencyException
     * @throws NotFoundException
     */
    public function make(
        Entity $entity,
        string $table,
        string|array|StringCollection $fields = ['*'],
    ): LoaderArgumentResolver {
        return $this->container->make(LoaderArgumentResolver::class, [
            'fields' => $fields,
            'entity' => $entity,
            'table' => $table,

        ]);
    }
}