from typing import Tuple


def _validate_added_file(file: str) -> Tuple[bool, str]:
    """
    Checks whether an added file detected by container-diff is located under /opt/pht_train.

    :param file: line of output generated by container diff containing info on the added file
    :return: whether the file is correctly located or not
    """
    path = file.split(" ")[0]
    valid = False

    print(f"Validate called with file: {file}")
    if not file:
        return True, path

    if len(path) > 1:
        path_dir = path.split("/")[1:]

        if path_dir[0] == "opt":

            if path_dir[1] == "pht_results":
                valid = True
            if path_dir[1] == "pht_train":
                valid = True

            if path_dir[1] == "train_config.json":
                valid = True

            if path_dir[1] == "user_sym_key.key":
                valid = True
    if not valid:
        print(f"Invalid file detected: {path}")

    return valid, path