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

export const keyboardRemoteDomain = "keyboard_remote";
export const keyboardRemoteDefaultName = "Keyboard Remote";

export type TKeyboardRemoteRawData = TSimpleLocalRawData;
export interface IKeyboardRemoteSnapshot extends ISimpleLocalSnapshot {}
export interface IKeyboardRemoteConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}

export const keyboardRemoteProfile: ISimpleLocalIntegrationProfile = {
  domain: keyboardRemoteDomain,
  displayName: "Keyboard Remote",
  manufacturer: "Keyboard Remote",
  model: "Keyboard Remote local integration",
  defaultName: keyboardRemoteDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "keyboard_remote",
    "Keyboard Remote",
    "Keyboard",
    "Remote",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/keyboard_remote",
    "upstreamDomain": "keyboard_remote",
    "integrationType": "hub",
    "iotClass": "local_push",
    "qualityScale": "legacy",
    "requirements": [
      "evdev==1.9.3",
      "asyncinotify==4.4.4",
    ],
    "codeowners": [
      "@bendavid",
      "@lanrat",
    ],
    "configFlow": false,
    "documentation": "https://www.home-assistant.io/integrations/keyboard_remote",
    "loggers": [
      "aionotify",
      "evdev",
    ],
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "implemented": [
        "manual local setup for Keyboard Remote endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Keyboard Remote device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native live Keyboard Remote key events: Home Assistant depends on Linux evdev==1.9.3 and asyncinotify==4.4.4 for /dev/input enumeration, device-name matching, inotify hotplug, device grab/ungrab, and key event reads; this repo has no evdev/inotify/ioctl stack",
        "claiming live Keyboard Remote polling, /dev/input subscription, hotplug monitoring, 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",
      ],
    },
  },
};
