"""
Because FSSpec is inconsistent in name mapping, we gotta do this.
"""

ASYNC_METHODS = [
    "acall",
    "acat",
    "acat_file",
    "acat_ranges",
    "acopy",
    "acp_file",
    "adu",
    "aexists",
    "aexpand_path",
    "afind",
    "aget",
    "aget_file",
    "agetxattr",
    "aglob",
    "ainfo",
    "ametadata",
    "aisdir",
    "aisfile",
    "alist_buckets",
    "alist_objects",
    "als",
    "amakedirs",
    "amerge",
    "amkdir",
    "apipe",
    "apipe_file",
    "aprocess_limits",
    "aput",
    "aput_file",
    "arm",
    "arm_file",
    "armdir",
    "arm_files",
    "asetxattrs",
    "asize",
    "asizes",
]

ASYNC_MAPPING_GS = {
    "_call": "acall",
    "_cat": "acat",
    "_cat_file": "acat_file",
    "_cat_ranges": "acat_ranges",
    "_copy": "acopy",
    "_cp_file": "acp_file",
    "_du": "adu",
    "_exists": "aexists",
    "_expand_path": "aexpand_path",
    "_find": "afind",
    "_get": "aget",
    "_get_file": "aget_file",
    "_getxattr": "agetxattr",
    "_glob": "aglob",
    "_info": "ainfo",
    "_metadata": "ametadata",
    "_isdir": "aisdir",
    "_isfile": "aisfile",
    "_list_buckets": "alist_buckets",
    "_list_objects": "alist_objects",
    "_ls": "als",
    #"_makedir": "amakedir",
    "_makedirs": "amakedirs",
    "_merge": "amerge",
    "_mkdir": "amkdir",
    "_pipe": "apipe",
    "_pipe_file": "apipe_file",
    "_process_limits": "aprocess_limits",
    "_put": "aput",
    "_put_file": "aput_file",
    "_rm": "arm",
    "_rm_file": "arm_file",
    "_rmdir": "armdir",
    "_rm_files": "arm_files",
    "_setxattrs": "asetxattrs",
    "_size": "asize",
    "_sizes": "asizes",
}


ASYNC_MAPPING_S3 = {
    "_call_s3": "acall",
    "_cat": "acat",
    "_cat_file": "acat_file",
    "_cat_ranges": "acat_ranges",
    "_copy": "acopy",
    "_cp_file": "acp_file",
    "_du": "adu",
    "_exists": "aexists",
    "_expand_path": "aexpand_path",
    "_find": "afind",
    "_get": "aget",
    "_get_file": "aget_file",
    "_getxattr": "agetxattr",
    "_glob": "aglob",
    "_info": "ainfo",
    "_metadata": "ametadata",
    "_isdir": "aisdir",
    "_isfile": "aisfile",
    "_lsbuckets": "alist_buckets",
    "_lsdir": "alist_objects",
    "_ls": "als",
    "_makedirs": "amakedirs",
    "_merge": "amerge",
    "_mkdir": "amkdir",
    "_pipe": "apipe",
    "_pipe_file": "apipe_file",
    "_process_limits": "aprocess_limits",
    "_put": "aput",
    "_put_file": "aput_file",
    "_rm": "arm",
    "_rm_file": "arm_file",
    "_rmdir": "armdir",
    "_bulk_delete": "arm_files",
    "_setxattr": "asetxattrs",
    "_size": "asize",
    "_sizes": "asizes",
}


ASYNC_MAPPING_AZ = {
    "_call": "acall",
    "_cat": "acat",
    "_cat_file": "acat_file",
    "_cat_ranges": "acat_ranges",
    "_copy": "acopy",
    "_cp_file": "acp_file",
    "_du": "adu",
    "_exists": "aexists",
    "_expand_path": "aexpand_path",
    "_find": "afind",
    "_get": "aget",
    "_get_file": "aget_file",
    "_getxattr": "agetxattr",
    "_glob": "aglob",
    "_info": "ainfo",
    "_metadata": "ametadata",
    "_isdir": "aisdir",
    "_isfile": "aisfile",
    "_list_buckets": "alist_buckets",
    "_list_objects": "alist_objects",
    "_ls": "als",
    #"_makedir": "amakedir",
    "_makedirs": "amakedirs",
    "_merge": "amerge",
    "_mkdir": "amkdir",
    "_pipe": "apipe",
    "_pipe_file": "apipe_file",
    "_process_limits": "aprocess_limits",
    "_put": "aput",
    "_put_file": "aput_file",
    "_rm": "arm",
    "_rm_file": "arm_file",
    "_rmdir": "armdir",
    "_rm_files": "arm_files",
    "_setxattrs": "asetxattrs",
    "_size": "asize",
    "_sizes": "asizes",
}

ASYNC_SYNTAX_MAPPING = {
    'gs': ASYNC_MAPPING_GS,
    's3': ASYNC_MAPPING_S3,
    'minio': ASYNC_MAPPING_S3,
    'az': ASYNC_MAPPING_AZ,
}