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

export const kiraDomain = "kira";
export const kiraDefaultName = "Kira";

export type TKiraRawData = TSimpleLocalRawData;
export interface IKiraSnapshot extends ISimpleLocalSnapshot {}
export interface IKiraCode {
  name: string;
  code: string;
  type?: string;
  device?: string;
  repeat?: number;
}

export interface IKiraConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
  codesPath?: string;
}

export const kiraProfile: ISimpleLocalIntegrationProfile = {
  domain: kiraDomain,
  displayName: "Kira",
  manufacturer: "Kira",
  model: "Kira local integration",
  defaultName: kiraDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "button",
    "sensor",
  ],
  serviceDomains: [
    "button",
  ],
  controlServices: [
    "press",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "kira",
    "Kira",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/kira",
    "upstreamDomain": "kira",
    "iotClass": "local_push",
    "qualityScale": "legacy",
    "requirements": [
      "pykira==0.1.1",
    ],
    "configFlow": false,
    "documentation": "https://www.home-assistant.io/integrations/kira",
    "loggers": [
      "pykira",
    ],
    "runtime": {
        "type": "read-only-runtime",
        "services": [
        "snapshot",
        "status",
        "refresh",
        "press",
      ],
      "platforms": [
        "button",
        "sensor",
      ],
        "controls": "Kira code-file snapshots are native; IR send/receive requires injected client.execute or commandExecutor because HA delegates the UDP protocol to pykira",
      },
      "localApi": {
        "implemented": [
          "native local file snapshots from the Home Assistant kira_codes.yaml code-file schema",
          "runtime mapping for Kira device snapshots and Home Assistant platform metadata",
          "manual snapshots, rawData, snapshotProvider, injected native clients, and commandExecutor fallback",
        ],
        "explicitUnsupported": [
          "native Kira IR send/receive over the pykira UDP IR-IP bridge protocol; Home Assistant source uses pykira.KiraReceiver/KiraModule and does not document an HTTP/TCP/TLS protocol",
          "claiming Kira press/send success without injected client.execute or commandExecutor",
          "Home Assistant entity registry migrations and repair flows",
        ],
      },
  },
};
