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

export const netioDomain = "netio";
export const netioDefaultName = "Netio";

export type TNetioRawData = TSimpleLocalRawData;
export interface INetioSnapshot extends ISimpleLocalSnapshot {}
export interface INetioConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
  outlets?: Record<string, string> | string[];
}
export interface IHomeAssistantNetioConfig extends INetioConfig {}

export const netioProfile: ISimpleLocalIntegrationProfile = {
  domain: netioDomain,
  displayName: "Netio",
  manufacturer: "Netio",
  model: "Netio local integration",
  defaultName: netioDefaultName,
  defaultPort: 1234,
  defaultTcpCommand: 'port list',
  defaultProtocol: 'telnet',
  status: "control-runtime",
  platforms: [
    "switch",
  ],
  serviceDomains: [
    "switch",
  ],
  controlServices: [
    "toggle",
    "turn_off",
    "turn_on",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "netio",
    "Netio",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/netio",
    "upstreamDomain": "netio",
    "iotClass": "local_polling",
    "qualityScale": "legacy",
    "requirements": [
      "pynetio==0.1.9.1",
    ],
    "dependencies": [
      "http",
    ],
    "configFlow": false,
    "documentation": "https://www.home-assistant.io/integrations/netio",
      "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "toggle",
        "turn_off",
        "turn_on",
      ],
      "platforms": [
        "switch",
      ],
      "controls": "native Netio telnet port control when host credentials are configured; injected executor fallback otherwise",
    },
    "localApi": {
      "implemented": [
        "live Netio telnet polling with login and port list state parsing on TCP port 1234",
        "live Netio outlet turn_on, turn_off, and toggle using port list masks",
        "manual local setup for Netio endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Netio device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor when no host is configured",
      ],
      "explicitUnsupported": [
        "Netio pairing, discovery subscription, or vendor cloud flows",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without a live Netio host or injected command executor",
      ],
    },
  },
};
