import subprocess


def extract(file: str, dst_dir: str) -> None:
    """
    extract the game into a directory
    :param file: game's file to extract (can be WBFS, ISO, CISO)
    :param dst_dir: where to extract the game
    """
    subprocess.run(["./tools/wit/wit", "EXTRACT", file, "--DEST", dst_dir],
                   creationflags=subprocess.CREATE_NO_WINDOW)


def edit(file: str, region_ID: str = "P", name: str = "<NAME>") -> None:
    """
    Edit game property like region or name
    :param file: game's file
    :param region_ID: new region_ID
    :param name: new name
    """
    subprocess.run(
        ["./tools/wit/wit", "EDIT", file, "--id", f"RMC{region_ID}60", "--name", name, "--modify", "ALL"],
        creationflags=subprocess.CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE)


def copy(src_path: str, dst_path: str, format: str = "ISO") -> None:
    """
    Copy the game into an another format
    :param src_path: original game path
    :param dst_path: new game path
    :param format: format for the new game
    """
    subprocess.run(["./tools/wit/wit", "COPY", src_path, "--DEST", dst_path, f"--{format.lower()}", "--overwrite"],
                   creationflags=subprocess.CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE)

import subprocess


def extract(file: str, dst_dir: str) -> None:
    """
    extract the game into a directory
    :param file: game's file to extract (can be WBFS, ISO, CISO)
    :param dst_dir: where to extract the game
    """
    subprocess.run(["./tools/wit/wit", "EXTRACT", file, "--DEST", dst_dir],
                   creationflags=subprocess.CREATE_NO_WINDOW)


def edit(file: str, region_ID: str = "P", name: str = "<NAME>") -> None:
    """
    Edit game property like region or name
    :param file: game's file
    :param region_ID: new region_ID
    :param name: new name
    """
    subprocess.run(
        ["./tools/wit/wit", "EDIT", file, "--id", f"RMC{region_ID}60", "--name", name, "--modify", "ALL"],
        creationflags=subprocess.CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE)


def copy(src_path: str, dst_path: str, format: str = "ISO") -> None:
    """
    Copy the game into an another format
    :param src_path: original game path
    :param dst_path: new game path
    :param format: format for the new game
    """
    subprocess.run(["./tools/wit/wit", "COPY", src_path, "--DEST", dst_path, f"--{format.lower()}", "--overwrite"],
                   creationflags=subprocess.CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE)

extract the game into a directory     :param file: game's file to extract (can be WBFS, ISO, CISO)     :param dst_dir: where to extract the game Edit game property like region or name     :param file: game's file     :param region_ID: new region_ID     :param name: new name Copy the game into an another format     :param src_path: original game path     :param dst_path: new game path     :param format: format for the new game