import typing

import android.net
import android.os
import java
import java.chaquopy
import java.lang
import java.net
import java.util
import java.util.concurrent

class AdvertisingRequest(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[AdvertisingRequest]] = ...
    FLAG_SKIP_PROBING: typing.ClassVar[int] = ...
    def describeContents(self) -> int: ...
    def equals(self, other: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getFlags(self) -> int: ...
    def getProtocolType(self) -> int: ...
    def getServiceInfo(self) -> NsdServiceInfo: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class Builder(java.lang.Object):
        def __init__(self, serviceInfo: NsdServiceInfo, /) -> None: ...
        def build(self) -> AdvertisingRequest: ...
        def setFlags(self, flags: int | java.jlong | java.lang.Long, /) -> AdvertisingRequest.Builder: ...
        def setProtocolType(self, protocolType: int | java.jint | java.lang.Integer, /) -> AdvertisingRequest.Builder: ...

class DiscoveryRequest(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[DiscoveryRequest]] = ...
    def describeContents(self) -> int: ...
    def equals(self, other: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getNetwork(self) -> android.net.Network | None: ...
    def getServiceType(self) -> str: ...
    def getSubtype(self) -> str | None: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class Builder(java.lang.Object):
        def __init__(self, serviceType: str | java.lang.String, /) -> None: ...
        def build(self) -> DiscoveryRequest: ...
        def setNetwork(self, network: android.net.Network, /) -> DiscoveryRequest.Builder: ...
        def setSubtype(self, subtype: str | java.lang.String, /) -> DiscoveryRequest.Builder: ...

class NsdManager(java.lang.Object):
    ACTION_NSD_STATE_CHANGED: typing.ClassVar[str] = ...
    EXTRA_NSD_STATE: typing.ClassVar[str] = ...
    FAILURE_ALREADY_ACTIVE: typing.ClassVar[int] = ...
    FAILURE_BAD_PARAMETERS: typing.ClassVar[int] = ...
    FAILURE_INTERNAL_ERROR: typing.ClassVar[int] = ...
    FAILURE_MAX_LIMIT: typing.ClassVar[int] = ...
    FAILURE_OPERATION_NOT_RUNNING: typing.ClassVar[int] = ...
    NSD_STATE_DISABLED: typing.ClassVar[int] = ...
    NSD_STATE_ENABLED: typing.ClassVar[int] = ...
    PROTOCOL_DNS_SD: typing.ClassVar[int] = ...
    @typing.overload
    def discoverServices(self, discoveryRequest: DiscoveryRequest, executor: java.util.concurrent.Executor, listener: NsdManager.DiscoveryListener, /) -> None: ...
    @typing.overload
    def discoverServices(self, serviceType: str | java.lang.String, protocolType: int | java.jint | java.lang.Integer, listener: NsdManager.DiscoveryListener, /) -> None: ...
    @typing.overload
    def discoverServices(self, serviceType: str | java.lang.String, protocolType: int | java.jint | java.lang.Integer, network: android.net.Network, executor: java.util.concurrent.Executor, listener: NsdManager.DiscoveryListener, /) -> None: ...
    @typing.overload
    def discoverServices(self, serviceType: str | java.lang.String, protocolType: int | java.jint | java.lang.Integer, networkRequest: android.net.NetworkRequest, executor: java.util.concurrent.Executor, listener: NsdManager.DiscoveryListener, /) -> None: ...
    @typing.overload
    def registerService(self, serviceInfo: NsdServiceInfo, protocolType: int | java.jint | java.lang.Integer, listener: NsdManager.RegistrationListener, /) -> None: ...
    @typing.overload
    def registerService(self, serviceInfo: NsdServiceInfo, protocolType: int | java.jint | java.lang.Integer, executor: java.util.concurrent.Executor, listener: NsdManager.RegistrationListener, /) -> None: ...
    def registerServiceInfoCallback(self, serviceInfo: NsdServiceInfo, executor: java.util.concurrent.Executor, listener: NsdManager.ServiceInfoCallback, /) -> None: ...
    @typing.overload
    def resolveService(self, serviceInfo: NsdServiceInfo, listener: NsdManager.ResolveListener, /) -> None: ...
    @typing.overload
    def resolveService(self, serviceInfo: NsdServiceInfo, executor: java.util.concurrent.Executor, listener: NsdManager.ResolveListener, /) -> None: ...
    def stopServiceDiscovery(self, listener: NsdManager.DiscoveryListener, /) -> None: ...
    def stopServiceResolution(self, listener: NsdManager.ResolveListener, /) -> None: ...
    def unregisterService(self, listener: NsdManager.RegistrationListener, /) -> None: ...
    def unregisterServiceInfoCallback(self, listener: NsdManager.ServiceInfoCallback, /) -> None: ...

    class ServiceInfoCallback(java.lang.Object):
        def onServiceInfoCallbackRegistrationFailed(self, arg1: int | java.jint | java.lang.Integer, /) -> None: ...
        def onServiceInfoCallbackUnregistered(self) -> None: ...
        def onServiceLost(self) -> None: ...
        def onServiceUpdated(self, arg1: NsdServiceInfo, /) -> None: ...

    class ResolveListener(java.lang.Object):
        def onResolutionStopped(self, serviceInfo: NsdServiceInfo, /) -> None: ...
        def onResolveFailed(self, arg1: NsdServiceInfo, arg2: int | java.jint | java.lang.Integer, /) -> None: ...
        def onServiceResolved(self, arg1: NsdServiceInfo, /) -> None: ...
        def onStopResolutionFailed(self, serviceInfo: NsdServiceInfo, errorCode: int | java.jint | java.lang.Integer, /) -> None: ...

    class RegistrationListener(java.lang.Object):
        def onRegistrationFailed(self, arg1: NsdServiceInfo, arg2: int | java.jint | java.lang.Integer, /) -> None: ...
        def onServiceRegistered(self, arg1: NsdServiceInfo, /) -> None: ...
        def onServiceUnregistered(self, arg1: NsdServiceInfo, /) -> None: ...
        def onUnregistrationFailed(self, arg1: NsdServiceInfo, arg2: int | java.jint | java.lang.Integer, /) -> None: ...

    class DiscoveryListener(java.lang.Object):
        def onDiscoveryStarted(self, arg1: str | java.lang.String, /) -> None: ...
        def onDiscoveryStopped(self, arg1: str | java.lang.String, /) -> None: ...
        def onServiceFound(self, arg1: NsdServiceInfo, /) -> None: ...
        def onServiceLost(self, arg1: NsdServiceInfo, /) -> None: ...
        def onStartDiscoveryFailed(self, arg1: str | java.lang.String, arg2: int | java.jint | java.lang.Integer, /) -> None: ...
        def onStopDiscoveryFailed(self, arg1: str | java.lang.String, arg2: int | java.jint | java.lang.Integer, /) -> None: ...

class NsdServiceInfo(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[NsdServiceInfo]] = ...
    def __init__(self) -> None: ...
    def describeContents(self) -> int: ...
    def getAttributes(self) -> java.util.Map[java.lang.String, java.chaquopy.JavaArrayJByte]: ...
    def getHost(self) -> java.net.InetAddress: ...
    def getHostAddresses(self) -> java.util.List[java.net.InetAddress]: ...
    def getHostname(self) -> str: ...
    def getNetwork(self) -> android.net.Network | None: ...
    def getPort(self) -> int: ...
    def getServiceName(self) -> str: ...
    def getServiceType(self) -> str: ...
    def getSubtypes(self) -> java.util.Set[java.lang.String]: ...
    def removeAttribute(self, key: str | java.lang.String, /) -> None: ...
    def setAttribute(self, key: str | java.lang.String, value: str | java.lang.String, /) -> None: ...
    def setHost(self, s: java.net.InetAddress, /) -> None: ...
    def setHostAddresses(self, addresses: java.util.List[java.net.InetAddress], /) -> None: ...
    def setNetwork(self, network: android.net.Network, /) -> None: ...
    def setPort(self, p: int | java.jint | java.lang.Integer, /) -> None: ...
    def setServiceName(self, s: str | java.lang.String, /) -> None: ...
    def setServiceType(self, s: str | java.lang.String, /) -> None: ...
    def setSubtypes(self, subtypes: java.util.Set[java.lang.String], /) -> None: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...
