"""System object for OS-Agent."""

from ...utils.dbus import DBus
from ..const import DBUS_NAME_HAOS, DBUS_OBJECT_HAOS_SYSTEM
from ..interface import DBusInterface
from ..utils import dbus_connected


class System(DBusInterface):
    """System object for OS Agent."""

    async def connect(self) -> None:
        """Get connection information."""
        self.dbus = await DBus.connect(DBUS_NAME_HAOS, DBUS_OBJECT_HAOS_SYSTEM)

    @dbus_connected
    async def schedule_wipe_device(self) -> None:
        """Schedule a factory reset on next system boot."""
        await self.dbus.System.ScheduleWipeDevice()
