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

export const moatDomain = "moat";
export const moatDefaultName = "Moat";

export type TMoatRawData = TSimpleLocalRawData;
export interface IMoatSnapshot extends ISimpleLocalSnapshot {}
export interface IMoatConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantMoatConfig extends IMoatConfig {}

export const moatProfile: ISimpleLocalIntegrationProfile = {
  domain: moatDomain,
  displayName: "Moat",
  manufacturer: "Moat",
  model: "Moat local integration",
  defaultName: moatDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "moat",
    "Moat",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/moat",
    "upstreamDomain": "moat",
    "integrationType": "device",
    "iotClass": "local_push",
    "requirements": [
      "moat-ble==0.1.1",
    ],
    "dependencies": [
      "bluetooth_adapters",
    ],
    "codeowners": [
      "@bdraco",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/moat",
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "implemented": [
        "manual local setup for Moat endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Moat device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "live native Moat BLE polling because Home Assistant depends on moat-ble and PassiveBluetoothProcessorCoordinator over a Bluetooth adapter stack",
        "Bluetooth passive discovery for local_name Moat_S* without an injected native BLE client or snapshotProvider",
        "pairing, subscription, or write/control services",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
