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

export const nessAlarmDomain = "ness_alarm";
export const nessAlarmDefaultName = "Ness Alarm";

export type TNessAlarmRawData = TSimpleLocalRawData;
export interface INessAlarmSnapshot extends ISimpleLocalSnapshot {}
export interface INessAlarmConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantNessAlarmConfig extends INessAlarmConfig {}

export const nessAlarmProfile: ISimpleLocalIntegrationProfile = {
  domain: nessAlarmDomain,
  displayName: "Ness Alarm",
  manufacturer: "Ness Alarm",
  model: "Ness Alarm local integration",
  defaultName: nessAlarmDefaultName,
  defaultProtocol: 'local',
  status: "control-runtime",
  platforms: [
    "binary_sensor",
  ],
  serviceDomains: [],
  controlServices: [
    "aux",
    "panic",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "ness_alarm",
    "Ness Alarm",
    "Ness",
    "Alarm",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/ness_alarm",
    "upstreamDomain": "ness_alarm",
    "iotClass": "local_push",
    "qualityScale": "legacy",
    "requirements": [
      "nessclient==1.3.1",
    ],
    "codeowners": [
      "@nickw444",
      "@poshy163",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/ness_alarm",
    "loggers": [
      "nessclient",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "aux",
        "panic",
      ],
      "platforms": [
        "alarm_control_panel",
        "binary_sensor",
      ],
      "controls": "injected only; native live access is blocked because HA delegates IP232 ASCII protocol handling to nessclient==1.3.1",
    },
    "localApi": {
      "status": "native live access unsupported; snapshot/rawData/snapshotProvider and injected client paths remain supported",
      "implemented": [
        "manual local setup for Ness Alarm snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Ness Alarm device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native live Ness Alarm IP232 TCP polling/control because Home Assistant delegates Ness D8X/D16X ASCII packet encoding, keepalive, reconnect, and event parsing to nessclient==1.3.1, which is not available as a TypeScript dependency",
        "direct serial/RS-232 access because nessclient uses pyserial_asyncio_fast for serial transport and this package has no serial dependency",
        "claiming live Ness Alarm polling, push 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",
      ],
    },
  },
};
