# pylint: disable=line-too-long
import os


__version__ = '0.1.0'

mtax_blueprints: list[tuple[str, str | None, int | None, str | None]] = [
    ('├── mtax', '_mtax', 0, None),
    ('├── mk', 'directory_tools.single_directory', None, None),
    ('│ ├── [dim](-r/--range)[/]', None, None, None),
    ('│ ├── (-dirs/--simple-directories)', 'directory_tools.simpledirs.create_simple_directories', 1, None),
    ('│ ├── (-datedirs/--date-directories)', 'directory_tools.datedirs.create_date_directories', 2, None),
    ('│ ├── [dim](-4w/--four-weeks)[/]', None, None, None),
    ('│ ├── [dim](-p/--parent)[/]', None, None, None),
    ('│ ├── [dim](--name)[/]', None, None, None),
    ('│ ├── [dim](--prefix)[/]', None, None, None),
    ('│ ├── [dim](--suffix)[/]', None, None, None),
    ('│ └── [dim](-s/--silent)[/]', None, None, None),
    ('├── rm', 'directory_tools.single_directory', None, None),
    ('│ ├── (-dirs/--simple-directories)', 'directory_tools.simpledirs.remove_simple_directories', 3, None),
    ('│ └── (-datedirs/--date-directories)', 'directory_tools.datedirs.remove_date_directories', 4, None),
    ('└── cache', 'mtax_cache.MtaxCache', 5, None),
    ('  ├── add', 'mtax_cache.MtaxCache.add_item', None, None),
    ('  ├── clear', 'mtax_cache.MtaxCache.clear', None, None),
    ('  ├── get', 'mtax_cache.MtaxCache.get_item', None, None),
    ('  ├── info', 'mtax_cache.MtaxCache.info', None, None),
    ('  ├── list', 'mtax_cache.MtaxCache.list_k_v_pairs', None, None),
    ('  ├── remove', 'mtax_cache.MtaxCache.remove', None, None),
    ('  ├── reset', 'mtax_cache.MtaxCache.reset', None, None),
    ('  ├── set', 'mtax_cache.MtaxCache.set_item', None, None),
    ('  └── time', 'mtax_cache.MtaxCache.ts', None, None),
    ('    ├── reset', 'mtax_cache.MtaxCache.timereset', None, None),
    ('    └── set', 'mtax_cache.MtaxCache.timeset', None, None)]

mtax_funcargs: list[tuple[str, str, int | str | None, str | None]] = [
    ('├── mtax', None, 6, None),
    ('│ ├── [green1 dim](-a)[/]', 'Shows the arguments of functions', '.', None),
    ('│ ├── [green1 dim](-b)[/]', 'Shows the blueprints ([default]classes[/]) of functions', '.', None),
    ('│ ├── [green1 dim](-c)[/]', 'Shows the commands while showing args and/or blueprints', '.', None),
    ('│ ├── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('│ ├── [green1 dim](--save)[/]', 'Save a file with the info here for projects or ease of use', '.', None),
    ('│ └── [green1 dim](--split)[/]', 'Split the lines for better readability', '.', None),
    ('├── mk', None, 7, None),
    ('│ ├── [green1 dim](-r/--range)[/]', None, '.', None),
    ('│ ├── [dim](-dirs)[/]', None, 6, None),
    ('│ ├── [dim](-datedirs)[/]', None, 3, None),
    ('│ ├── [green1 dim](-4w/--four-weeks)[/]', None, '.', None),
    ('│ ├── [green1 dim](-p/--parent)[/]', None, '.', None),
    ('│ ├── [green1 dim](--name)[/]', None, '.', None),
    ('│ ├── [green1 dim](--prefix)[/]', None, '.', None),
    ('│ ├── [green1 dim](--suffix)[/]', None, '.', None),
    ('│ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('├── rm', None, 7, None),
    ('│ ├── [green1 dim](-r/--range)[/]', None, '.', None),
    ('│ ├── [dim](-dirs)[/]', None, 6, None),
    ('│ ├── [dim](-datedirs)[/]', None, 3, None),
    ('│ ├── [green1 dim](-4w/--four-weeks)[/]', None, '.', None),
    ('│ ├── [green1 dim](-p/--parent)[/]', None, '.', None),
    ('│ ├── [green1 dim](--name)[/]', None, '.', None),
    ('│ ├── [green1 dim](--prefix)[/]', None, '.', None),
    ('│ ├── [green1 dim](--suffix)[/]', None, '.', None),
    ('│ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('└── cache', None, '0', None),
    ('  ├── add', None, 2, None),
    ('  │ ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('  │ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('  ├── clear', None, 2, None),
    ('  │ ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('  │ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('  ├── get', None, 2, None),
    ('  │ ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('  │ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('  ├── info', None, 2, None),
    ('  │ ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('  │ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('  ├── list', None, 2, None),
    ('  │ ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('  │ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('  ├── remove', None, 2, None),
    ('  │ ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('  │ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('  ├── reset', None, 2, None),
    ('  │ ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('  │ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('  ├── set', None, 2, None),
    ('  │ ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('  │ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('  └── time', None, '0', None),
    ('    ├── reset', None, 2, None),
    ('    │ ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('    │ └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None),
    ('    └── set', None, 2, None),
    ('      ├── [green1 dim](-tz/--timezone)[/]', 'Change the timezone object for time-data', '.', None),
    ('      └── [green1 dim](-s)[/]', 'Silence extreneous messages in console', '.', None)]

mtax_commands: list[tuple[str, str, int | None, str | None]] = [
    ('├── mtax', 'this command (prints list of commands)', 1, None),
    ('├── mk', 'Creates a single folder in the current local directory', None, None),
    ('│ ├── (-r)', '...', None, None),
    ('│ ├── (-dirs)', 'Creates new blank folders in a range', 2, 'default_range: 1'),
    ('│ ├── (-datedirs)', 'Creates new datetime folders in a range', 3, 'default_range: *1yr'),
    ('│ ├── (-4w)', '...', None, None),
    ('│ ├── (-p)', '...', None, None),
    ('│ ├── (--name)', '...', None, None),
    ('│ ├── (--prefix)', '...', None, None),
    ('│ ├── (--suffix)', '...', None, None),
    ('│ └── (-s)', '...', None, None),
    ('├── rm', 'Removes a single folder in the current local directory', None, None),
    ('│ ├── (-dirs)', 'Removes blank folders in a range', 4, 'default_range: 1'),
    ('│ └── (-datedirs)', 'Removes datetime folders in a range', 5, 'default_range: *1yr'),
    ('└── cache', 'Operations for the cache of mtax', None, None),
    ('  ├── add', 'Add to the cache', 6, None),
    ('  ├── clear', 'Clear the cache', 7, None),
    ('  ├── get', 'Gets an item from the cache', 8, None),
    ('  ├── info', 'Shows various info about the cache', 9, None),
    (' ├── list', 'List the items stored in the cache', 10, None),
    (' ├── remove', 'Remove the matching item from the cache', 11, None),
    (' ├── reset', 'Reset stuck items in the cache', 12, None),
    (' ├── set', 'Set a item in the cache (Overwrite)', 13, None),
    ('  └── time', 'Manage time-data in the cache', None, None),
    ('    ├── reset', 'Reset time-data in the cache', 14, None),
    ('    └── set', 'Set a timestamp to time-data in the cache', 15, None)]

def mtax_complete(
    *,
    commands: bool = True,
    func_args: bool = False,
    blueprints: bool = False
):
    mtax_available: list[str] = [
        "## mtax\n\n",
        "### mtax.(--split)\n\n",
        "### mtax.(--save)\n\n",
        "### mtax.(-a)\n\n",
        "### mtax.(-b)\n\n",
        "### mtax.(-c)\n\n",
        "### mtax.(-s)\n\n",
        "## mk\n\n",
        "### mk.(-dirs)\n\n",
        "### mk.(-datedirs)\n\n",
        "## rm\n\n",
        "### rm.(-dirs)\n\n",
        "### rm.(-datedirs)\n\n",
        "## cache\n\n",
        "## add\n\n",
        "## clear\n\n",
        "## get\n\n",
        "## info\n\n",
        "## list\n\n",
        "## remove\n\n",
        "## reset\n\n",
        "## set\n\n",
        "## time\n\n",
        "## time.reset\n\n",
        "## time.set\n\n"]

    available: list[str] = [
        "The command that prints a list of commands (or generates this file)\n\n",
        "...\n\n",
        "...\n\n",
        "...\n\n",
        "...\n\n",
        "...\n\n",
        "...\n\n",
        "Creates a single folder in the current local directory\n\n",
        "Creates new blank folders in a range\n\n",
        "Creates new datetime folders in a range\n\n",
        "Removes a single folder in the current local directory\n\n",
        "Removes blank folders in a range\n\n",
        "Removes datetime folders in a range\n\n",
        "Operations for the cache of mtax\n\n",
        "Add to the cache\n\n",
        "Clear the cache\n\n",
        "Gets an item from the cache\n\n",
        "Shows various info about the cache\n\n",
        "List the items stored in the cache\n\n",
        "Remove the matching item from the cache\n\n",
        "Reset stuck items in the cache\n\n",
        "Set a item in the cache (Overwrite)\n\n",
        "Manage time-data in the cache\n\n",
        "Reset time-data in the cache\n\n",
        "Set a timestamp to time-data in the cache\n\n"]
    blueprnts: list[str] = [
        "  `...`\n\n",
        "  None\n\n",
        "  None\n\n",
        "  None\n\n",
        "  None\n\n",
        "  None\n\n",
        "  None\n\n",
        "  None\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n",
        "  `...`\n\n"]
    arguments: list[str] = [
        "- [--split]\n- [-s-a]\n- [-s-b]\n- [-s-c]\n- [--save]\n- [-a]\n- [-b]\n- [-c]\n- [-s]\n- [-ss]\n",
        "None\n",
        "None\n",
        "None\n",
        "None\n",
        "None\n",
        "None\n",
        "None\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n",
        "- ...\n"]

    if commands:
        mtax_available = [item + desc for item, desc in zip(mtax_available, available)]
    if blueprints:
        mtax_available = [item + desc for item, desc in zip(mtax_available, blueprnts)]
    if func_args:
        mtax_available = [item + desc for item, desc in zip(mtax_available, arguments)]

    cwd = os.path.join(os.getcwd(), '.mtax')
    cmd_fd = os.path.join(cwd, 'commands.md')

    os.makedirs(cwd, exist_ok=True)
    with open(cmd_fd, 'w', encoding='UTF-8') as commands_file:
        commands_file.write(f'# MontyAlex\n\nA list of all mtax commands available as of v{__version__}\n\n')
        commands_file.writelines('\n'.join(mtax_available))
