# Copyright Sebastian Wiesner <sebastian@swsnr.de>
#
# Licensed under the EUPL
#
# See https://interoperable-europe.ec.europa.eu/collection/eupl/eupl-text-eupl-12

"""Debug information for Turn On."""

import sys
from pathlib import Path

import gi
from gi.repository import Adw, GLib, Gtk

import turnon


def compile_debug_report() -> str:
    """Compile a debug report."""
    is_flatpak = Path("/.flatpak-info").exists()
    glib_version = f"{GLib.MAJOR_VERSION}.{GLib.MINOR_VERSION}.{GLib.MICRO_VERSION}"
    gtk_version = f"{Gtk.MAJOR_VERSION}.{Gtk.MINOR_VERSION}.{Gtk.MICRO_VERSION}"
    adw_version = f"{Adw.MAJOR_VERSION}.{Adw.MINOR_VERSION}.{Adw.MICRO_VERSION}"
    return f"""Turn On version: {turnon.version()}

Editable?: {turnon.is_installed_editable()}
Flatpak?:  {is_flatpak}

Python:    {sys.version}
PyGObject: {gi.__version__}
GLib:      {glib_version}
Gtk:       {gtk_version}
Adw:       {adw_version}
"""
