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

export const netgearDomain = "netgear";
export const netgearDefaultName = "NETGEAR";

export type TNetgearRawData = TSimpleLocalRawData;
export interface INetgearSnapshot extends ISimpleLocalSnapshot {}
export interface INetgearConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantNetgearConfig extends INetgearConfig {}

export const netgearProfile: ISimpleLocalIntegrationProfile = {
  domain: netgearDomain,
  displayName: "NETGEAR",
  manufacturer: "NETGEAR",
  model: "NETGEAR local integration",
  defaultName: netgearDefaultName,
  defaultProtocol: 'local',
  status: "control-runtime",
  platforms: [
    "button",
    "sensor",
    "switch",
    "update",
  ],
  serviceDomains: [
    "button",
    "switch",
  ],
  controlServices: [
    "press",
    "toggle",
    "turn_off",
    "turn_on",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "netgear",
    "NETGEAR",
    "Netgear",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/netgear",
    "upstreamDomain": "netgear",
    "integrationType": "hub",
    "iotClass": "local_polling",
    "requirements": [
      "pynetgear==0.10.10",
    ],
    "codeowners": [
      "@Quentame",
      "@starkillerOG",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/netgear",
    "loggers": [
      "pynetgear",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "press",
        "toggle",
        "turn_off",
        "turn_on",
      ],
      "platforms": [
        "button",
        "device_tracker",
        "sensor",
        "switch",
        "update",
      ],
      "controls": "injected only; native live access is blocked because HA delegates reverse-engineered NETGEAR SOAP handling to pynetgear==0.10.10",
    },
    "localApi": {
      "status": "native live access unsupported; snapshot/rawData/snapshotProvider and injected client paths remain supported",
      "implemented": [
        "manual local setup for NETGEAR snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for NETGEAR device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native live NETGEAR router polling/control because Home Assistant delegates login, port probing, and reverse-engineered SOAP calls to pynetgear==0.10.10, which is not available as a TypeScript dependency and is not documented as a stable local HTTP API in HA source/docs",
        "NETGEAR SSDP-triggered SOAP port/SSL probing without pynetgear-compatible protocol support",
        "claiming live NETGEAR polling, pairing, subscription, or write success without an injected native client, commandExecutor, rawData, snapshot, or snapshotProvider",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
