from typing import Any, Iterator

from {{PACKAGE_NAME}}.domains.{{TARGET_DOMAIN}}.model import {{DomainRecord}}
from {{PACKAGE_NAME}}.sources.{{ORIGIN}}.{{DATASET}}.dto import {{OriginDTO}}


def {{FUNCTION_NAME}}(
    stream: Iterator[{{OriginDTO}}],
    **params: Any,
) -> Iterator[{{DomainRecord}}]:
    """Map raw {{ORIGIN}} DTOs to domain-level {{TARGET_DOMAIN}} records.

    - Required on domain record: time and value.
    - Additional options may be passed via kwargs (e.g., variant="..." or mode="...").
    """
    for dto in stream:
        # TODO: construct {{DomainRecord}} from dto fields
        yield {{DomainRecord}}(
            time=dto.time, # must include time
            value=dto.value, # must include value
            # additional fields...
            )
