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

export const keeneticNdms2Domain = "keenetic_ndms2";
export const keeneticNdms2DefaultName = "Keenetic NDMS2 Router";
export const keeneticNdms2DefaultPort = 23;
export const keeneticNdms2DefaultTimeoutMs = 5000;
export const keeneticNdms2DefaultInterface = 'Home';

export type TKeeneticNdms2RawData = TSimpleLocalRawData;
export interface IKeeneticNdms2Snapshot extends ISimpleLocalSnapshot {}
export interface IKeeneticNdms2Config extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
  interfaces?: string[];
  tryHotspot?: boolean;
  includeArp?: boolean;
  includeAssociated?: boolean;
  considerHome?: number;
}
export interface IHomeAssistantKeeneticNdms2Config extends IKeeneticNdms2Config {}

export const keeneticNdms2Profile: ISimpleLocalIntegrationProfile = {
  domain: keeneticNdms2Domain,
  displayName: "Keenetic NDMS2 Router",
  manufacturer: "Keenetic NDMS2 Router",
  model: "Keenetic NDMS2 Router local integration",
  defaultName: keeneticNdms2DefaultName,
  defaultPort: keeneticNdms2DefaultPort,
  defaultProtocol: 'telnet',
  status: "read-only-runtime",
  platforms: [
    "binary_sensor",
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "keenetic_ndms2",
    "Keenetic NDMS2 Router",
    "Keenetic Ndms2",
    "Keenetic",
    "NDMS2",
    "Router",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/keenetic_ndms2",
    "upstreamDomain": "keenetic_ndms2",
    "integrationType": "device",
    "iotClass": "local_polling",
    "requirements": [
      "ndms2-client==0.1.2",
    ],
    "codeowners": [
      "@foxel",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/keenetic_ndms2",
    "loggers": [
      "ndms2_client",
    ],
    "runtime": {
      "type": "read-only-runtime",
      "polling": "native local Telnet NDMS2 CLI polling on port 23",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "binary_sensor",
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "implemented": [
        "manual local setup for Keenetic NDMS2 Router Telnet endpoints on port 23, snapshots, rawData, snapshotProvider, and injected native clients",
        "native Telnet login and NDMS2 CLI polling for show version, show ip hotspot, show ip arp, and show associations data used by Home Assistant",
        "runtime mapping for router connectivity plus tracked client presence metadata",
      ],
      "explicitUnsupported": [
        "write/control services; Home Assistant keenetic_ndms2 only exposes binary_sensor and device_tracker state",
        "claiming live Keenetic NDMS2 Router polling without config.host, username, password, and Telnet access",
        "Keenetic cloud APIs, pairing flows, SSH-only devices, and automatic router configuration changes",
        "Home Assistant entity registry migrations and repair flows",
      ],
    },
  },
};
