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

export const insteonDomain = "insteon";
export const insteonDefaultName = "Insteon";

export type TInsteonRawData = TSimpleLocalRawData;
export interface IInsteonSnapshot extends ISimpleLocalSnapshot {}
export interface IInsteonConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantInsteonConfig extends IInsteonConfig {}

export const insteonProfile: ISimpleLocalIntegrationProfile = {
  domain: insteonDomain,
  displayName: "Insteon",
  manufacturer: "Insteon",
  model: "Insteon local integration",
  defaultName: insteonDefaultName,
  defaultProtocol: 'local',
  status: "control-runtime",
  platforms: [
    "binary_sensor",
    "climate",
    "cover",
    "fan",
    "light",
    "switch",
  ],
  serviceDomains: [
    "climate",
    "cover",
    "fan",
    "light",
    "switch",
  ],
  controlServices: [
    "add_all_link",
    "add_default_links",
    "close_cover",
    "delete_all_link",
    "load_all_link_database",
    "open_cover",
    "print_all_link_database",
    "print_im_all_link_database",
    "scene_off",
    "scene_on",
    "set_hvac_mode",
    "set_temperature",
    "stop_cover",
    "toggle",
    "turn_off",
    "turn_on",
    "x10_all_lights_off",
    "x10_all_lights_on",
    "x10_all_units_off",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "insteon",
    "Insteon",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/insteon",
    "upstreamDomain": "insteon",
    "integrationType": "hub",
    "iotClass": "local_push",
    "requirements": [
      "pyinsteon==1.6.4",
      "insteon-frontend-home-assistant==0.6.2",
    ],
    "dependencies": [
      "http",
      "usb",
      "websocket_api",
    ],
    "afterDependencies": [
      "panel_custom",
    ],
    "codeowners": [
      "@teharris1",
      "@ssyrell",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/insteon",
    "loggers": [
      "pyinsteon",
      "pypubsub",
    ],
    "runtime": {
      "type": "control-runtime",
      "polling": "unsupported natively; Home Assistant delegates PLM/Hub state loading and subscriptions to pyinsteon",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "add_all_link",
        "add_default_links",
        "close_cover",
        "delete_all_link",
        "load_all_link_database",
        "open_cover",
        "print_all_link_database",
        "print_im_all_link_database",
        "scene_off",
        "scene_on",
        "set_hvac_mode",
        "set_temperature",
        "stop_cover",
        "toggle",
        "turn_off",
        "turn_on",
        "x10_all_lights_off",
        "x10_all_lights_on",
        "x10_all_units_off",
      ],
      "platforms": [
        "binary_sensor",
        "climate",
        "cover",
        "fan",
        "light",
        "switch",
      ],
      "controls": "delegated only to an injected client.execute or commandExecutor",
    },
    "localApi": {
      "implemented": [
        "manual snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Insteon device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native live Insteon PLM/Hub connection, pairing/linking, subscriptions, device database loading, and controls require the unavailable pyinsteon Python library and its binary protocol state model",
        "USB/serial PLM transport because no serial stack dependency is available in this package",
        "Insteon Hub v1/v2 TCP ports 9761/25105 because HA source delegates the undocumented PLM binary framing and device modeling to pyinsteon rather than exposing an HTTP/TLS/file API",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
