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

export const inkbirdDomain = "inkbird";
export const inkbirdDefaultName = "INKBIRD";

export type TInkbirdRawData = TSimpleLocalRawData;
export interface IInkbirdSnapshot extends ISimpleLocalSnapshot {}
export interface IInkbirdConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantInkbirdConfig extends IInkbirdConfig {}

export const inkbirdProfile: ISimpleLocalIntegrationProfile = {
  domain: inkbirdDomain,
  displayName: "INKBIRD",
  manufacturer: "INKBIRD",
  model: "INKBIRD local integration",
  defaultName: inkbirdDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "inkbird",
    "INKBIRD",
    "Inkbird",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/inkbird",
    "upstreamDomain": "inkbird",
    "integrationType": "device",
    "iotClass": "local_push",
    "requirements": [
      "inkbird-ble==1.1.1",
    ],
    "dependencies": [
      "bluetooth_adapters",
    ],
    "codeowners": [
      "@bdraco",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/inkbird",
    "runtime": {
      "type": "read-only-runtime",
      "polling": "unsupported natively; Home Assistant uses BLE advertisements/active polling through inkbird-ble and bluetooth_adapters",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "implemented": [
        "manual snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for INKBIRD device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native live INKBIRD BLE scanning, advertisement decoding, connectable polling, and notification handling require the unavailable inkbird-ble Python library plus a BLE stack/bluetooth_adapters",
        "Home Assistant ActiveBluetoothProcessorCoordinator and PassiveBluetoothDataProcessor lifecycle without a BLE adapter stack",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
