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

export const manualMqttDomain = "manual_mqtt";
export const manualMqttDefaultName = "Manual MQTT Alarm Control Panel";

export type TManualMqttRawData = TSimpleLocalRawData;
export interface IManualMqttSnapshot extends ISimpleLocalSnapshot {}
export interface IManualMqttConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}

export const manualMqttProfile: ISimpleLocalIntegrationProfile = {
  domain: manualMqttDomain,
  displayName: "Manual MQTT Alarm Control Panel",
  manufacturer: "Manual MQTT Alarm Control Panel",
  model: "Manual MQTT Alarm Control Panel local integration",
  defaultName: manualMqttDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "binary_sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "manual_mqtt",
    "Manual MQTT Alarm Control Panel",
    "Manual Mqtt",
    "Manual",
    "MQTT",
    "Alarm",
    "Control",
    "Panel",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/manual_mqtt",
    "upstreamDomain": "manual_mqtt",
    "iotClass": "local_push",
    "qualityScale": "legacy",
    "dependencies": [
      "mqtt",
    ],
    "configFlow": false,
    "documentation": "https://www.home-assistant.io/integrations/manual_mqtt",
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "binary_sensor",
      ],
      "controls": false,
      "blocker": "Home Assistant manual_mqtt is alarm state logic wired through the HA mqtt integration; native operation requires MQTT broker subscribe/publish semantics and no MQTT client dependency is available in this package.",
    },
    "localApi": {
      "implemented": [
        "manual local setup for Manual MQTT Alarm Control Panel endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Manual MQTT Alarm Control Panel device snapshots and Home Assistant platform metadata",
        "safe snapshotProvider and injected native-client snapshot behavior only",
      ],
      "explicitUnsupported": [
        "native Manual MQTT Alarm command/state topic handling because Home Assistant delegates this integration to mqtt.async_subscribe and mqtt.async_publish broker semantics",
        "opening or emulating an MQTT broker/client session without adding an MQTT dependency",
        "Home Assistant entity registry migrations and repair flows",
        "claiming alarm state changes from MQTT payloads without a real broker-backed subscription/publish path",
      ],
    },
  },
};
