import type { ISimpleLocalConfig, ISimpleLocalIntegrationProfile, ISimpleLocalSnapshot, TSimpleLocalRawData } from '../../core/index.js';

export const ld2410BleDomain = "ld2410_ble";
export const ld2410BleDefaultName = "LD2410 BLE";

export type TLd2410BleRawData = TSimpleLocalRawData;
export interface ILd2410BleSnapshot extends ISimpleLocalSnapshot {}
export interface ILd2410BleConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantLd2410BleConfig extends ILd2410BleConfig {}

export const ld2410BleProfile: ISimpleLocalIntegrationProfile = {
  domain: ld2410BleDomain,
  displayName: "LD2410 BLE",
  manufacturer: "LD2410 BLE",
  model: "LD2410 BLE local integration",
  defaultName: ld2410BleDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "binary_sensor",
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "ld2410_ble",
    "LD2410 BLE",
    "Ld2410 Ble",
    "LD2410",
    "BLE",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/ld2410_ble",
    "upstreamDomain": "ld2410_ble",
    "integrationType": "device",
    "iotClass": "local_push",
    "requirements": [
      "bluetooth-data-tools==1.28.4",
      "ld2410-ble==0.1.1",
    ],
    "dependencies": [
      "bluetooth_adapters",
    ],
    "codeowners": [
      "@930913",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/ld2410_ble",
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "binary_sensor",
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "status": "no native live client: Home Assistant uses Bluetooth discovery/active BLE sessions through bleak/ld2410-ble, which requires an unavailable BLE stack and Python library",
      "implemented": [
        "manual local setup for LD2410 BLE endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for LD2410 BLE device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native live LD2410 BLE polling, pairing, subscription, or writes without a BLE stack; Home Assistant uses bleak_retry_connector and ld2410-ble",
        "reimplementing BLE GATT pairing/session semantics from the Python ld2410-ble dependency without that library or a documented non-BLE local protocol",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
