from enum import Enum
from typing import Any, Callable, Dict, List, NoReturn, Optional, Tuple

import consul  # 明确导入consul模块

class ConfigFormat(Enum):
    Text: Callable
    Number: Callable
    Int: Callable
    Float: Callable
    Json: Callable
    Yaml: Callable
    Hcl: Callable

def path_join(*args: str) -> str: ...
def fetch_key(
    key_path: str, fmt: Callable = None, client: Optional["ConsulClient"] = None
) -> Any: ...
def register_service(service_name: str, **kwargs) -> NoReturn: ...
def deregister(service_id) -> NoReturn: ...
def get_services(client: Optional["ConsulClient"] = None) -> Dict: ...
def find_service(
    query: str, by_id: bool = False, client: Optional["ConsulClient"] = None
) -> Dict: ...
def register_check(name: str, check: Dict, **kwargs) -> None: ...
def deregister_check(check_id: str) -> None: ...
def create_session(name: str = None, ttl: str = None, **kwargs) -> str: ...
def destroy_session(session_id: str) -> bool: ...
def renew_session(session_id: str) -> bool: ...
def acquire_lock(key: str, session_id: str, value: str = None) -> bool: ...
def release_lock(key: str, session_id: str) -> bool: ...
def list_keys(prefix: str, client: Optional["ConsulClient"] = None) -> List[Dict]: ...

class KvProperty:
    def __init__(
        self,
        key: str,
        /,
        prefix: str = None,
        namespace: str = None,
        format: callable = None,
        cached: bool = None,
    ) -> None: ...

class ConsulClient:
    def __init__(
        self,
        host: str = "127.0.0.1",
        port: int = 8500,
        token: str = None,
        scheme: str = "http",
        consistency: str = "default",
        dc: str = None,
        verify: bool = True,
    ) -> None: ...
    @property
    def client(self) -> consul.Consul: ...
    def kv_get(self, key: str, **kwargs) -> Any: ...
    def kv_put(self, key: str, value: str, **kwargs) -> bool: ...
    def kv_list(self, prefix: str, **kwargs) -> Tuple[int, List[Dict]]: ...
    def kv_delete(self, key: str, **kwargs) -> bool: ...
    def service_register(self, name: str, **kwargs) -> None: ...
    def service_deregister(self, service_id: str) -> None: ...
    def services(self) -> Dict: ...
    def check_register(self, name: str, check: Dict, **kwargs) -> None: ...
    def check_deregister(self, check_id: str) -> None: ...
    def checks(self) -> Dict: ...
    def session_create(self, name: str = None, **kwargs) -> str: ...
    def session_destroy(self, session_id: str) -> bool: ...
    def session_renew(self, session_id: str) -> bool: ...
    def lock_acquire(self, key: str, session_id: str, value: str = None) -> bool: ...
    def lock_release(self, key: str, session_id: str) -> bool: ...
