

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: blickfeld/config/services/storage.proto
# plugin: python-betterproto
import asyncio
from dataclasses import dataclass
from typing import (
    TYPE_CHECKING,
    Dict,
    Optional,
)

import blickfeld_qb2.betterproto as betterproto
import blickfeld_qb2.betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
import grpclib
from blickfeld_qb2.betterproto.grpc.grpclib_server import ServiceBase


if TYPE_CHECKING:
    import grpclib.server
    from blickfeld_qb2.betterproto.grpc.grpclib_client import MetadataLike
    from grpclib.metadata import Deadline


class Storage(betterproto.ServiceStub):
    """
    The Storage service provides access to the key / value based configuration
    of the device.
    """

    async def async_factory_reset(
        self,
        timeout: Optional[float] = None,
        deadline: Optional["Deadline"] = None,
        metadata: Optional["MetadataLike"] = None,
    ) -> "betterproto_lib_google_protobuf.Empty":
        """
        Delete all user generated settings, log files and cached data
        WARNING: All non-factory provided settings in the device configuration
        will be permanently lost.
        """

        request = betterproto_lib_google_protobuf.Empty()

        return await self._unary_unary(
            "/blickfeld.config.services.Storage/FactoryReset",
            request,
            betterproto_lib_google_protobuf.Empty,
            timeout=timeout,
            deadline=deadline,
            metadata=metadata,
        )

    def factory_reset(
        self,
        timeout: Optional[float] = None,
        deadline: Optional["Deadline"] = None,
        metadata: Optional["MetadataLike"] = None,
    ) -> "betterproto_lib_google_protobuf.Empty":
        """
        Delete all user generated settings, log files and cached data
        WARNING: All non-factory provided settings in the device configuration
        will be permanently lost.
        """

        loop = asyncio.get_event_loop()
        return loop.run_until_complete(
            self.async_factory_reset(
                timeout=timeout,
                deadline=deadline,
                metadata=metadata,
            )
        )
