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

export const improvBleDomain = "improv_ble";
export const improvBleDefaultName = "Improv via BLE";

export type TImprovBleRawData = TSimpleLocalRawData;
export interface IImprovBleSnapshot extends ISimpleLocalSnapshot {}
export interface IImprovBleConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}

export const improvBleProfile: ISimpleLocalIntegrationProfile = {
  domain: improvBleDomain,
  displayName: "Improv via BLE",
  manufacturer: "Improv via BLE",
  model: "Improv via BLE local integration",
  defaultName: improvBleDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'bluetooth',
    'custom',
  ],
  discoveryKeywords: [
    "improv_ble",
    "Improv via BLE",
    "Improv Ble",
    "Improv",
    "via",
    "BLE",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/improv_ble",
    "upstreamDomain": "improv_ble",
    "integrationType": "device",
    "iotClass": "local_polling",
    "requirements": [
      "py-improv-ble-client==2.0.1",
    ],
    "dependencies": [
      "bluetooth_adapters",
    ],
    "codeowners": [
      "@emontnemery",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/improv_ble",
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "implemented": [
        "safe manual snapshots, rawData, snapshotProvider, and injected read-only native clients",
        "runtime mapping for Improv via BLE discovery/provisioning metadata only",
      ],
      "explicitUnsupported": [
        "native Improv BLE provisioning because Home Assistant uses py-improv-ble-client and bleak, and this package has no BLE stack dependency",
        "Bluetooth adapter scanning, GATT characteristic reads/writes, authorization button handling, and Wi-Fi credential pairing",
        "claiming live Improv via BLE polling, pairing, provisioning, subscription, or write success without an injected native client or snapshotProvider",
        "Home Assistant entity registry migrations and repair flows",
      ],
    },
  },
};
