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

export const landisgyrHeatMeterDomain = "landisgyr_heat_meter";
export const landisgyrHeatMeterDefaultName = "Landis+Gyr Heat Meter";

export type TLandisgyrHeatMeterRawData = TSimpleLocalRawData;
export interface ILandisgyrHeatMeterSnapshot extends ISimpleLocalSnapshot {}
export interface ILandisgyrHeatMeterConfig extends ISimpleLocalConfig {
  url?: string;
  filePath?: string;
  macAddress?: string;
  deviceId?: string;
  model?: string;
  deviceNumber?: string;
}

export const landisgyrHeatMeterProfile: ISimpleLocalIntegrationProfile = {
  domain: landisgyrHeatMeterDomain,
  displayName: "Landis+Gyr Heat Meter",
  manufacturer: "Landis & Gyr",
  model: "Landis+Gyr Heat Meter local integration",
  defaultName: landisgyrHeatMeterDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "landisgyr_heat_meter",
    "Landis+Gyr Heat Meter",
    "Landisgyr Heat Meter",
    "Landis+Gyr",
    "Heat",
    "Meter",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/landisgyr_heat_meter",
    "upstreamDomain": "landisgyr_heat_meter",
    "integrationType": "device",
    "iotClass": "local_polling",
    "requirements": [
      "ultraheat-api==0.5.7",
    ],
    "dependencies": [
      "usb",
    ],
    "codeowners": [
      "@vpathuis",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/landisgyr_heat_meter",
    "runtime": {
      "type": "read-only-runtime",
      "status": "native local file-reader parsing is implemented for documented ultraheat-api test telegram files; direct USB/IR serial polling is intentionally unsupported without a Node serial stack",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "implemented": [
        "documented ultraheat-api FileReader-compatible local file snapshots via config.filePath",
        "native telegram parsing for Landis+Gyr Ultraheat/T550 measurement fields exposed by Home Assistant sensors",
        "runtime mapping for Landis+Gyr Heat Meter device snapshots and Home Assistant platform metadata",
        "snapshot/rawData/injected-client operation without claiming direct USB serial access",
      ],
      "explicitUnsupported": [
        "direct live USB/IR serial polling because Home Assistant uses ultraheat-api with pyserial and this package has no Node serial dependency",
        "probing /dev/tty* or waking a battery-powered meter without an explicit supported serial implementation",
        "Home Assistant entity registry migrations and repair flows",
        "write/control services; Landis+Gyr Heat Meter data is read-only",
      ],
    },
  },
};
