import type { DeviceConnectionItem, LocalPeripheralBinding, PeripheralConnectTarget, PeripheralDevice, PeripheralPlugin, PeripheralUsage } from '../types';
interface BaseServiceParams {
    app?: any;
    connection: DeviceConnectionItem;
}
interface ConnectPeripheralConnectionParams extends BaseServiceParams {
    plugin?: PeripheralPlugin;
    target: PeripheralDevice | PeripheralConnectTarget;
    peripheralUsage?: PeripheralUsage;
}
interface RemovePeripheralConnectionParams extends BaseServiceParams {
    plugin?: PeripheralPlugin;
    physicalDevice?: PeripheralDevice;
}
interface SyncLocalPeripheralBindingsParams {
    app?: any;
    connections: DeviceConnectionItem[];
}
interface UpdatePeripheralUsageParams extends BaseServiceParams {
    localBinding?: LocalPeripheralBinding;
    physicalDevice?: PeripheralDevice;
    peripheralUsage: PeripheralUsage;
}
/** 获取宿主注入的 SQLite 适配器；未注入时返回空值，由调用方自然降级。 */
export declare const getSQLiteAdapter: (app?: any) => Promise<any>;
/** 保存单条外设本地绑定，用于刷新后恢复物理设备状态和业务用途。 */
export declare const saveLocalPeripheralBinding: (app: any, binding: LocalPeripheralBinding) => Promise<void>;
/** 读取所有本地外设绑定，并过滤掉缺少连接关系 ID 的异常记录。 */
export declare const getLocalPeripheralBindings: (app?: any) => Promise<LocalPeripheralBinding[]>;
/** 删除单条业务连接关系对应的本地外设绑定。 */
export declare const deleteLocalPeripheralBinding: (app: any, connection: DeviceConnectionItem) => Promise<void>;
/**
 * 同步 SQLite 外设绑定。
 *
 * 该方法会保留仍存在于云端连接列表中的绑定，并删除本地陈旧绑定，
 * 确保首屏合并时不会使用已经失效的物理设备状态。
 */
export declare const syncLocalPeripheralBindings: ({ app, connections, }: SyncLocalPeripheralBindingsParams) => Promise<LocalPeripheralBinding[]>;
/**
 * 将一条业务连接关系连接到指定物理外设。
 *
 * 执行顺序：
 * 1. 根据 `uuid` 或 `ip` 调用原生外设插件的连接能力。
 * 2. 将原生返回的物理设备状态和可选业务用途写入 SQLite 绑定表。
 *
 * @returns 已连接的物理设备，以及同步后的本地绑定记录。
 */
export declare const connectPeripheralConnection: ({ app, plugin, connection, target, peripheralUsage, }: ConnectPeripheralConnectionParams) => Promise<{
    physicalDevice: PeripheralDevice;
    binding: LocalPeripheralBinding;
}>;
/**
 * 保存原生返回的物理设备状态。
 *
 * 该方法只写 SQLite 绑定表并返回本地绑定结果，不调用云端连接状态接口；
 * 云端同步由宿主全局状态监听负责。
 */
export declare const savePeripheralConnectionStatus: ({ app, connection, physicalDevice, peripheralUsage, }: {
    app?: any;
    connection: DeviceConnectionItem;
    physicalDevice: PeripheralDevice;
    peripheralUsage?: PeripheralUsage | undefined;
}) => Promise<{
    binding: LocalPeripheralBinding;
    physicalDevice: PeripheralDevice;
}>;
/**
 * 忽略或删除连接时清理本地与原生记录。
 *
 * 如果已知物理设备 `uuid` 且插件支持 `remove`，先清理原生侧记录；
 * 随后删除当前业务连接关系对应的 SQLite 绑定。
 */
export declare const removePeripheralConnection: ({ app, plugin, connection, physicalDevice, }: RemovePeripheralConnectionParams) => Promise<void>;
/**
 * 更新标签打印机的业务用途。
 *
 * 业务用途只属于本地设置，不写云端连接关系，也不会重新调用原生连接。
 */
export declare const updatePeripheralUsage: ({ app, connection, localBinding, physicalDevice, peripheralUsage, }: UpdatePeripheralUsageParams) => Promise<{
    binding: {
        physical_uuid: string | undefined;
        physical_device: PeripheralDevice | undefined;
        is_connect: boolean;
        id: string;
        connection_id: number;
        source_device_id: number;
        target_device_id: number;
        type_code: string;
        model_code?: string | undefined;
        /**
         * 忽略或删除连接时清理本地与原生记录。
         *
         * 如果已知物理设备 `uuid` 且插件支持 `remove`，先清理原生侧记录；
         * 随后删除当前业务连接关系对应的 SQLite 绑定。
         */
        peripheral_usage?: PeripheralUsage | undefined;
        updated_at: number;
        payload: DeviceConnectionItem;
    };
    physicalDevice: PeripheralDevice | undefined;
}>;
export {};
