Refactor Input/Output types, add DocumentLoaderType plugin system and dynamic factory service
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3574454. -->
Reported by: [ahmad khader](https://www.drupal.org/user/3727855)
Related to !6 !8
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Refactor Input and Output type classes to eliminate redundancy, introduce shared base interfaces, fix a bug in <code>getSupportedOutputTypes()</code>, register the <code>DocumentLoaderManager</code> service, and add <code>isAvailable()</code> to <code>DocumentLoaderInterface</code>.</p>
<h3>Problem</h3>
<p><strong>1. Redundant Input/Output classes:</strong> Eight Input classes (TextInput, JsonInput, CsvInput, HtmlInput, XmlInput, YamlInput, MarkdownInput, TomlInput) and eight Output classes had identical code — same constructor, same <code>getContent()</code>, same <code>getMetadata()</code>. This violated DRY and made maintenance error-prone.</p>
<p><strong>2. Identical interfaces:</strong> <code>DocumentLoaderInputInterface</code> and <code>DocumentLoaderOutputInterface</code> declared the exact same methods (<code>getContent()</code> and <code>getMetadata()</code>) independently with no shared contract.</p>
<p><strong>3. No file-based input:</strong> All format-specific inputs (PDF, CSV, Word, etc.) are file-based, but there was no general-purpose <code>FileInput</code> class. <code>PdfInput</code> had its own standalone file URI logic.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ul>
<li>Introduce <code>DocumentLoaderType</code> attribute-based plugin system with <code>input_class</code> parameter linking each type to its Input class.</li>
<li>Add a Drupal service (<code>document_loader.type_factory</code>) that queries the type plugin manager dynamically.</li>
<li>Add <code>string $output_format = 'text'</code> parameter to <code>DocumentLoaderInterface::load()</code>; remove <code>getOutputFormat()</code> from inputs.</li>
<li>Make output format intrinsic to <code>ContentOutput</code> via constructor parameter.</li>
<li>Unify URL input constructors to <code>($url, array $options = [])</code>.</li>
<li>Refactor <code>detectInputType()</code> to use plugin manager instead of reflection.</li>
</ul>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue