from typing import Self


class HtmlNode:
    def __init__(
        self: Self,
        tag: str | None = None,
        value: str | None = None,
        children: list["HtmlNode"] | None = None,
        props: dict | None = None,
    ) -> None:
        self.tag = tag
        self.value = value
        self.children = children
        self.props = props

    def __repr__(self: Self) -> str:
        return f"{HtmlNode.__name__}({self.tag}, {self.value}, {self.children}, {self.props})"

    def to_html(self: Self) -> str:
        raise NotImplementedError

    def props_to_html(self: Self) -> str:
        if self.props is None:
            return ""

        result = []

        for prop in self.props:
            result.append(f' {prop}="{self.props[prop]}"')

        return "".join(result)
