from __future__ import annotations

from app.core.agent.processes.v2.workflows.doc_update_from_feature_v2.subprocesses.common.document_composer import (
    TemplateDocumentComposer,
)
from app.core.agent.processes.v2.workflows.doc_update_from_feature_v2.subprocesses.common.template_models import (
    SectionDraft,
    TemplateSpec,
)

class ComposeDocumentStep:
    def __init__(self, composer: TemplateDocumentComposer | None = None) -> None:
        self._composer = composer or TemplateDocumentComposer()

    def run(self, frontmatter: str, template: TemplateSpec, sections: list[SectionDraft], fallback_title: str) -> str:
        return self._composer.compose(template, frontmatter, sections, fallback_title)
