#!/usr/bin/python3
# -*- coding: utf-8 -*-

import os
import tempfile
from pathlib import Path

from sun.sys_info import get_os_info as REAL_GET_OS_INFO  # noqa: F401
from sun.sys_info import get_static_paths as REAL_GET_STATIC_PATHS  # noqa: F401

# Create temp directories for config, xdg autostart and packages.
TMP_CONF_DIR = tempfile.mkdtemp()
TMP_XDG_DIR = tempfile.mkdtemp()
TMP_PKG_DIR = tempfile.mkdtemp()

# Create a valid sun.conf for testing.
_CONF_CONTENT = """\
[REPOSITORY]
HTTP_MIRROR = https://mirrors.slackware.com/slackware/slackware64-15.0/
LOG_PATH = /var/lib/slackpkg/
LOG_FILE = ChangeLog.txt
IGNORE_MIRROR_WARNING = false
HTTP_TIMEOUT = 30

[TIME]
INTERVAL = 720
STANDBY = 5
NOTIFICATIONS = true

[TRAY_ICON]
DELAY_LOAD = 5
MAX_PACKAGES = 10
BADGE_INTERVAL = 180
COLORED_OUTPUT = true
LOG_FONT_SIZE = 10
"""
with open(os.path.join(TMP_CONF_DIR, 'sun.conf'), 'w', encoding='utf-8') as _f:
    _f.write(_CONF_CONTENT)

MOCK_STATIC_PATHS = {
    'bin_path': Path('/usr/bin'),
    'pkg_path': Path(TMP_PKG_DIR),
    'icon_path': Path('/usr/share/pixmaps'),
    'desktop_path': Path('/usr/share/applications'),
    'xdg_autostart': Path(TMP_XDG_DIR),
    'sun_conf_path': Path(TMP_CONF_DIR),
}

MOCK_OS_INFO = {
    'os_name': 'Slackware 15.0',
    'desktop': 'KDE',
    'arch': 'x86_64',
    'hostname': 'testhost',
    'kernel': '5.15.0',
    'cpu': 'x86_64',
    'cpu_cores': 4,
    'logical_cores': 8,
    'mem_used': 1024 * 1024 * 512,
    'mem_free': 1024 * 1024 * 1024 * 2,
    'mem_total': 1024 * 1024 * 1024 * 4,
    'mem_percent': 50.0,
    'disk_total': 100 * 1024 ** 3,
    'disk_used': 50 * 1024 ** 3,
    'disk_free': 50 * 1024 ** 3,
    'disk_type': 'ext4',
    'disk_percent': 50.0,
    'uptime': '1:00:00',
    'gpu': 'NVIDIA GeForce RTX 3080',
}
