import typing

import chitragupt.core.logger as logger

uninitialized_logger = logger.GuptLogger(
    config=logger.LoggerConfig(
        name="Uninitialized System", level=logger.LogLevel.DEBUG
    )
)


def read_text(
    path: str,
) -> typing.Optional[str]:
    try:
        with open(
            path,
            "r",
        ) as f:
            return f.read() or None
    except FileNotFoundError:
        uninitialized_logger.log(
            f"File not found: {path}", logger.LogType.ERROR
        )
        return None
    except Exception as e:
        Warning("Exception while reading file: " + str(e))


__version__: typing.Final = "0.2"
__developer__: typing.Final = "xsyncio"
__readme__: typing.Final = read_text("README.md")
__banner__: typing.Final = read_text("chitragupt/assets/banner.txt")
__announcement_url__: typing.Final = "https://raw.githubusercontent.com/xsyncio/ChitraGupt-Plugin-Garden/refs/heads/main/announcements.json"
__plugin_garden_url__: typing.Final = (
    "https://github.com/xsyncio/ChitraGupt-Plugin-Garden"
)
__license__: typing.Final = read_text("LICENSE.md")
__copyright__: typing.Final = f"Copyright (c) 2025-present {__developer__}"
__plugin_garden_url_slug__: typing.Final = "xsyncio/ChitraGupt-Plugin-Garden"
__repo_slug__: typing.Final = "xsyncio/chitragupt"
