from typing import Dict
from typing import List


def create_dirs_list(all_confs: Dict[int, Dict[str, list]]) -> List[dict]:
    """Creates required directories for a project.

    Uses the information provided by `config_info()`
    to create directories according to the user's configuration
    file.

    Args:
        all_confs (Dict[str, list]): A `dict` of configuration
            information. This should be created using the
            `config_info()` function.

    Returns:
        List[dict]: A list of directories to create. Each `item` in
            the list is a `dict` that contains scene names as `keys`
            and scene elements as `values`. Scene elements are what
            `good-bot` will record or create.
    """
    if not isinstance(all_confs, dict):
        raise TypeError(
            "create_dirs_list(): This function takes a dictionnary as an input."
        )

    dirs_list: List[dict] = []

    for (
        scene_number,
        contents,
    ) in all_confs.items():  # Keys are scene numbers, values is the content

        # Those dirs are always created
        to_create: List[str] = ["asciicasts", "embeds", "gifs", "videos"]

        for content_type, instructions in contents.items():
            if instructions:  # There are items in the list.
                to_create.append(content_type)  # Things like the editor are added here.

        # Read has been added in the previous block
        if "read" in to_create:
            to_create.append("audio")  # MP3 files

        dirs_list.append({f"scene_{scene_number}": to_create})

    return dirs_list