# Path: mlog/apsw_wrapper.py
# class Connection(apsw.Connection, ContextManagerMixin):
#     def __init__(self, filename: Union[PathLike, str], *args):
#         super().__init__(str(filename), *args)


import asyncio
import apsw
import discord
from contextlib import suppress
from datetime import datetime
from typing import List, Literal, Optional, Set
from redbot.core import checks, commands
from redbot.core.bot import Red
from redbot.core.data_manager import cog_data_path
from redbot.core.utils.chat_formatting import pagify
from redbot.core.utils.menus import DEFAULT_CONTROLS, menu
from .apsw_wrapper import Connection
from __future__ import annotations





class MLog(commands.Cog):
    """ WIP """

    __red_end_user_data_statement__ = (
        "This cog logs messages and does not respect the data APIs. "
        "Bot owners have been warned against loading this cog as it is a work in progress. "
        "Bot owners will receive notice of attempts to delete data and it is on them to handle "
        "this manually at the current time."
    )

    async def red_delete_data_for_user(
        self,
        *,
        requester: Literal["discord_deleted_user", "owner", "user", "user_strict"],
        user_id: int,
    ):
        await self.bot.send_to_owners(
            f"Data deletion request for `MLog` by {requester} for user id {user_id}."
        )

    def __init__(self, bot: Red):
        self.bot: Red = bot
        self.active_guild_ids: Set[int] = set()
        fp = cog_data_path(self) / "data.db"

# Path: mlog/apsw_wrapper.py
# class Connection(apsw.Connection, ContextManagerMixin):
#     def __init__(self, filename: Union[PathLike, str], *args):
#         super().__init__(str(filename), *args)


# Path: mlog/core.py
import asyncio
import apsw
import discord
from contextlib import suppress
from datetime import datetime
from typing import List, Literal, Optional, Set
from redbot.core import checks, commands
from redbot.core.bot import Red
from redbot.core.data_manager import cog_data_path
from redbot.core.utils.chat_formatting import pagify
from redbot.core.utils.menus import DEFAULT_CONTROLS, menu
from .apsw_wrapper import Connection

from __future__ import annotations





class MLog(commands.Cog):
    """ WIP """

    __red_end_user_data_statement__ = (
        "This cog logs messages and does not respect the data APIs. "
        "Bot owners have been warned against loading this cog as it is a work in progress. "
        "Bot owners will receive notice of attempts to delete data and it is on them to handle "
        "this manually at the current time."
    )

    async def red_delete_data_for_user(
        self,
        *,
        requester: Literal["discord_deleted_user", "owner", "user", "user_strict"],
        user_id: int,
    ):
        await self.bot.send_to_owners(
            f"Data deletion request for `MLog` by {requester} for user id {user_id}."
        )

    def __init__(self, bot: Red):
        self.bot: Red = bot
        self.active_guild_ids: Set[int] = set()
        fp = cog_data_path(self) / "data.db"

        self._connection = Connection(fp)