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

export const edl21Domain = 'edl21';
export const edl21DefaultName = 'Smart Meter';

export type TEdl21RawData = TSimpleLocalRawData;
export interface IEdl21Snapshot extends ISimpleLocalSnapshot {}
export interface IEdl21Config extends ISimpleLocalConfig {
  serialPort?: string;
  serial_port?: string;
}
export interface IHomeAssistantEdl21Config extends IEdl21Config {}

export const edl21Profile: ISimpleLocalIntegrationProfile = {
  domain: 'edl21',
  displayName: 'EDL21',
  model: 'Smart Meter',
  defaultName: edl21DefaultName,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'sensor',
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'usb',
    'custom',
  ],
  discoveryKeywords: [
    'edl21',
    'sml',
    'smart meter',
    'serial',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/edl21',
    upstreamDomain: 'edl21',
    integrationType: 'hub',
    iotClass: 'local_push',
    qualityScale: undefined,
    requirements: [
      'pysml==0.1.5',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [],
    configFlow: true,
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual local serial endpoint metadata setup',
        'snapshot, raw data, snapshotProvider, and injected native client operation',
        'EDL21 SML telegram snapshot mapping for Home Assistant OBIS sensor descriptions',
      ],
      explicitUnsupported: [
        'opening and decoding a live serial SML stream without injected client or snapshotProvider',
        'claiming live command success without injected client.execute or commandExecutor',
        'cloud account flows and remote API polling',
      ],
    },
  },
};
