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

export const numatoDomain = "numato";
export const numatoDefaultName = "Numato USB GPIO Expander";

export type TNumatoRawData = TSimpleLocalRawData;
export interface INumatoSnapshot extends ISimpleLocalSnapshot {}
export interface INumatoConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantNumatoConfig extends INumatoConfig {}

export const numatoProfile: ISimpleLocalIntegrationProfile = {
  domain: numatoDomain,
  displayName: "Numato USB GPIO Expander",
  manufacturer: "Numato USB GPIO Expander",
  model: "Numato USB GPIO Expander local integration",
  defaultName: numatoDefaultName,
  defaultProtocol: 'local',
  status: "control-runtime",
  platforms: [
    "binary_sensor",
    "sensor",
    "switch",
  ],
  serviceDomains: [
    "switch",
  ],
  controlServices: [
    "toggle",
    "turn_off",
    "turn_on",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "numato",
    "Numato USB GPIO Expander",
    "Numato",
    "USB",
    "GPIO",
    "Expander",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/numato",
    "upstreamDomain": "numato",
    "integrationType": "hub",
    "iotClass": "local_push",
    "qualityScale": "legacy",
    "requirements": [
      "numato-gpio==0.13.0",
    ],
    "codeowners": [
      "@clssn",
    ],
    "configFlow": false,
    "documentation": "https://www.home-assistant.io/integrations/numato",
    "loggers": [
      "numato_gpio",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "toggle",
        "turn_off",
        "turn_on",
      ],
      "platforms": [
        "binary_sensor",
        "sensor",
        "switch",
      ],
      "controls": "snapshot/injected-client only; Home Assistant's live Numato access is USB serial through Python numato-gpio/pyserial, which is not available in this package",
    },
    "localApi": {
      "implemented": [
        "manual local setup for Numato USB GPIO Expander endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Numato USB GPIO Expander device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native live Numato USB GPIO polling/control against /dev/ttyACM* devices; Home Assistant delegates this to the unavailable Python numato-gpio/pyserial serial stack",
        "direct USB serial discovery, edge detection, GPIO setup, ADC reads, and GPIO writes without an injected native client",
        "claiming live Numato USB GPIO Expander polling, pairing, subscription, or write success without an injected native client or snapshotProvider",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
