from ..connections.protocol import Connection as Connection
from ..connections.sslsocket import TlsSocket as TlsSocket
from ..schema.base_schema import BlobValue as BlobValue, Device as Device, IdList as IdList, Network as Network, NumberValue as NumberValue, State as State, StringValue as StringValue, WappstoObject as WappstoObject, XmlValue as XmlValue
from ..schema.iot_schema import Identifier as Identifier, JsonData as JsonData, JsonReply as JsonReply, Success as Success, WappstoMethod as WappstoMethod
from ..utils import observer as observer, tracer as tracer
from ..utils.certificateread import certificate_info_extraction as certificate_info_extraction
from .template import ServiceClass as ServiceClass, StatusID as StatusID
from _typeshed import Incomplete
from pathlib import Path
from typing import Callable, Optional, Union
from uuid import UUID

ValueUnion = Union[StringValue, NumberValue, BlobValue, XmlValue]

class IoTAPI(ServiceClass):
    wappstoPort: Incomplete
    log: Incomplete
    ca: Incomplete
    crt: Incomplete
    key: Incomplete
    timeout: int
    fast_send: Incomplete
    connection: Incomplete
    subscribers: Incomplete
    jsonrpc: Incomplete
    killed: Incomplete
    workers: Incomplete
    def __init__(self, ca: Path, crt: Path, key: Path, worker_count: int = ..., fast_send: bool = ...) -> None: ...
    def close(self) -> None: ...
    def ping(self): ...
    def subscribe_network_event(self, uuid: UUID, callback: Callable[[Network, WappstoMethod], None]): ...
    def unsubscribe_network_event(self, uuid: UUID, callback: Callable[[Network, WappstoMethod], None]): ...
    def post_network(self, data: Network) -> bool: ...
    def put_network(self, uuid: UUID, data: Network) -> bool: ...
    def get_network(self, uuid: UUID) -> Optional[Network]: ...
    def delete_network(self, uuid: UUID) -> bool: ...
    def subscribe_device_event(self, uuid: UUID, callback: Callable[[Device, WappstoMethod], None]): ...
    def unsubscribe_device_event(self, uuid: UUID, callback: Callable[[Device, WappstoMethod], None]): ...
    def post_device(self, network_uuid: UUID, data: Device) -> bool: ...
    def put_device(self, uuid: UUID, data: Device) -> bool: ...
    def get_device_where(self, network_uuid: UUID, **kwargs: str) -> Optional[UUID]: ...
    def get_device(self, uuid: UUID) -> Union[Device, None]: ...
    def delete_device(self, uuid: UUID) -> bool: ...
    def subscribe_value_event(self, uuid: UUID, callback: Callable[[ValueUnion, WappstoMethod], None]): ...
    def unsubscribe_value_event(self, uuid: UUID, callback: Callable[[Device, WappstoMethod], None]): ...
    def post_value(self, device_uuid: UUID, data: ValueUnion) -> bool: ...
    def put_value(self, uuid: UUID, data: ValueUnion) -> bool: ...
    def get_value_where(self, device_uuid: UUID, **kwargs: str) -> Optional[UUID]: ...
    def get_value(self, uuid: UUID) -> Union[ValueUnion, None]: ...
    def delete_value(self, uuid: UUID) -> bool: ...
    def subscribe_state_event(self, uuid: UUID, callback: Callable[[State, WappstoMethod], None]): ...
    def unsubscribe_state_event(self, uuid: UUID, callback: Callable[[Device, WappstoMethod], None]): ...
    def post_state(self, value_uuid: UUID, data: State) -> bool: ...
    def put_state(self, uuid: UUID, data: State) -> bool: ...
    def get_state(self, uuid: UUID) -> Union[State, None]: ...
    def delete_state(self, uuid: UUID) -> bool: ...
