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

export const localIpDomain = "local_ip";
export const localIpDefaultName = "Local IP Address";

export type TLocalIpRawData = TSimpleLocalRawData;
export interface ILocalIpSnapshot extends ISimpleLocalSnapshot {}
export interface ILocalIpConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
  targetHost?: string;
  target_host?: string;
  targetPort?: number;
  target_port?: number;
}

export const localIpProfile: ISimpleLocalIntegrationProfile = {
  domain: localIpDomain,
  displayName: "Local IP Address",
  manufacturer: "Local IP Address",
  model: "Local IP Address local integration",
  defaultName: localIpDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "local_ip",
    "Local IP Address",
    "Local Ip",
    "Local",
    "IP",
    "Address",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/local_ip",
    "upstreamDomain": "local_ip",
    "iotClass": "local_polling",
    "dependencies": [
      "network",
    ],
    "codeowners": [
      "@issacg",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/local_ip",
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "implemented": [
        "native TCP source-address probe using config.targetHost/config.targetPort or config.host/config.port",
        "runtime mapping for Local IP Address snapshots and Home Assistant platform metadata",
        "manual snapshots, rawData, snapshotProvider, and injected native clients",
      ],
      "explicitUnsupported": [
        "Home Assistant network.async_get_source_ip UDP route probing and enabled-adapter filtering require HA's Python network/ifaddr helper; the native runtime requires a reachable TCP target",
        "Home Assistant entity registry migrations and repair flows",
        "command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
