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

export const ironOsDomain = "iron_os";
export const ironOsDefaultName = "IronOS";

export type TIronOsRawData = TSimpleLocalRawData;
export interface IIronOsSnapshot extends ISimpleLocalSnapshot {}
export interface IIronOsConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantIronOsConfig extends IIronOsConfig {}

export const ironOsProfile: ISimpleLocalIntegrationProfile = {
  domain: ironOsDomain,
  displayName: "IronOS",
  manufacturer: "IronOS",
  model: "IronOS local integration",
  defaultName: ironOsDefaultName,
  defaultProtocol: 'local',
  status: "control-runtime",
  platforms: [
    "binary_sensor",
    "button",
    "number",
    "select",
    "sensor",
    "switch",
    "update",
  ],
  serviceDomains: [
    "button",
    "number",
    "select",
    "switch",
  ],
  controlServices: [
    "press",
    "select_option",
    "set_value",
    "toggle",
    "turn_off",
    "turn_on",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "iron_os",
    "IronOS",
    "Iron Os",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/iron_os",
    "upstreamDomain": "iron_os",
    "integrationType": "device",
    "iotClass": "local_polling",
    "qualityScale": "platinum",
    "requirements": [
      "pynecil==4.2.1",
    ],
    "dependencies": [
      "bluetooth_adapters",
    ],
    "codeowners": [
      "@tr4nt0r",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/iron_os",
    "loggers": [
      "pynecil",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "press",
        "select_option",
        "set_value",
        "toggle",
        "turn_off",
        "turn_on",
      ],
      "platforms": [
        "binary_sensor",
        "button",
        "number",
        "select",
        "sensor",
        "switch",
        "update",
      ],
      "controls": "delegated only to an injected client.execute or commandExecutor",
    },
    "localApi": {
      "status": "No native IronOS live client is implemented; Home Assistant communicates through pynecil over Bluetooth LE/GATT and requires bleak/habluetooth Bluetooth adapter support.",
      "implemented": [
        "manual local setup for IronOS endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for IronOS device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native IronOS Bluetooth polling, pairing, and GATT writes; Home Assistant depends on pynecil plus bleak/habluetooth and Bluetooth adapter/proxy semantics unavailable in this TypeScript runtime",
        "native firmware update checks through pynecil's GitHub helper beyond injected snapshot/client data",
        "claiming live IronOS polling, pairing, subscription, or write success without an injected native client, commandExecutor, snapshotProvider, snapshot, or rawData",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
