from blends.models import (
    NId,
)
from blends.syntax.models import (
    SyntaxGraphArgs,
)


def build_unary_expression_node(
    args: SyntaxGraphArgs,
    operator: str,
    operand_id: NId,
) -> NId:
    args.syntax_graph.add_node(
        args.n_id,
        operator=operator,
        operand_id=operand_id,
        label_type="UnaryExpression",
    )

    args.syntax_graph.add_edge(
        args.n_id,
        args.generic(args.fork_n_id(operand_id)),
        label_ast="AST",
    )

    return args.n_id
