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

export const litejetDomain = "litejet";
export const litejetDefaultName = "LiteJet";

export type TLitejetRawData = TSimpleLocalRawData;
export interface ILitejetSnapshot extends ISimpleLocalSnapshot {}
export interface ILitejetConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}

export const litejetProfile: ISimpleLocalIntegrationProfile = {
  domain: litejetDomain,
  displayName: "LiteJet",
  manufacturer: "LiteJet",
  model: "LiteJet local integration",
  defaultName: litejetDefaultName,
  defaultProtocol: 'local',
  status: "control-runtime",
  platforms: [
    "button",
    "light",
    "switch",
  ],
  serviceDomains: [
    "button",
    "light",
    "switch",
  ],
  controlServices: [
    "press",
    "toggle",
    "turn_off",
    "turn_on",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "litejet",
    "LiteJet",
    "Litejet",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/litejet",
    "upstreamDomain": "litejet",
    "integrationType": "hub",
    "iotClass": "local_push",
    "requirements": [
      "pylitejet==0.6.3",
    ],
    "codeowners": [
      "@joncar",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/litejet",
    "loggers": [
      "pylitejet",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "press",
        "toggle",
        "turn_off",
        "turn_on",
      ],
      "platforms": [
        "button",
        "light",
        "switch",
      ],
      "controls": "delegated only to an injected client.execute or commandExecutor; native LiteJet requires RS232 serial access",
    },
    "localApi": {
      "implemented": [
        "manual local setup for LiteJet snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for LiteJet device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native LiteJet RS232 polling/control: Home Assistant depends on pylitejet and pyserial serial_for_url at 19.2 Kbaud; this repository has no serial-port transport dependency and LiteJet is not an HTTP/TCP/TLS/file protocol",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
