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

export const mqttStatestreamDomain = "mqtt_statestream";
export const mqttStatestreamDefaultName = "MQTT Statestream";

export type TMqttStatestreamRawData = TSimpleLocalRawData;
export interface IMqttStatestreamSnapshot extends ISimpleLocalSnapshot {}
export interface IMqttStatestreamConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantMqttStatestreamConfig extends IMqttStatestreamConfig {}

export const mqttStatestreamProfile: ISimpleLocalIntegrationProfile = {
  domain: mqttStatestreamDomain,
  displayName: "MQTT Statestream",
  manufacturer: "MQTT Statestream",
  model: "MQTT Statestream local integration",
  defaultName: mqttStatestreamDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "mqtt_statestream",
    "MQTT Statestream",
    "Mqtt Statestream",
    "MQTT",
    "Statestream",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/mqtt_statestream",
    "upstreamDomain": "mqtt_statestream",
    "iotClass": "local_push",
    "qualityScale": "legacy",
    "requirements": [],
    "dependencies": [
      "mqtt",
    ],
    "configFlow": false,
    "documentation": "https://www.home-assistant.io/integrations/mqtt_statestream",
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "status": "snapshot/injected-client only; native live MQTT Statestream subscription requires MQTT broker semantics and an MQTT client/broker dependency not present in this package.",
      "implemented": [
        "manual local setup for MQTT Statestream snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for MQTT Statestream device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native live MQTT Statestream reads: Home Assistant only publishes state changes into MQTT topics and consuming them requires MQTT broker subscription/session semantics",
        "implementing MQTT broker/client behavior without an MQTT dependency; this package has no native MQTT protocol stack",
        "claiming live MQTT Statestream polling, pairing, subscription, or write success without an injected native client, MQTT-capable executor, or snapshotProvider",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
