from typing import Dict
from typing import List
from pathlib import Path
import yaml


def write_commands_instructions(
    commands_instructions: Dict[str, List[str]], scene_path: Path, index: int
) -> Path:
    """*Deprecated, use `write_yaml_instructions` instead.*

    Writes a command instruction `yaml` file.

    These are the files that [`runner`](github.com/TrickyTroll/good-bot-runner)
    takes as input to type commands and expect stuff.

    Args:
        commands_instructions (Dict[str, List[str]]): A dictionary of commands
            and things to expect. Keys should be either `commands` or
            `expect`. The values should be a list of commands and a list of
            things to expect.
        scene_path (Path): The path towards the scene where the
            `commands_instructions` come from.
        index (int): The index of the command block.

    Returns:
        Path: The path towards where the new `yaml` file has been written.
    """
    commands_path: Path = scene_path / Path("commands")
    file_path: Path = commands_path / Path(f"commands_{index + 1}").with_suffix(".yaml")
    to_write: str = yaml.safe_dump(commands_instructions)

    with open(file_path, "w") as stream:
        stream.write(to_write)

    return file_path