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

export const egaugeDomain = 'egauge';
export const egaugeDefaultName = 'eGauge';

export type TEgaugeRawData = TSimpleLocalRawData;
export interface IEgaugeSnapshot extends ISimpleLocalSnapshot {}
export interface IEgaugeConfig extends ISimpleLocalConfig {}
export interface IHomeAssistantEgaugeConfig extends IEgaugeConfig {}

export const egaugeProfile: ISimpleLocalIntegrationProfile = {
  domain: 'egauge',
  displayName: 'eGauge',
  manufacturer: 'eGauge Systems',
  model: 'eGauge Energy Monitor',
  defaultName: 'eGauge',
  defaultProtocol: 'https',
  status: 'read-only-runtime',
  platforms: [
    'sensor',
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    'egauge',
    'energy',
    'monitor',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/egauge',
    upstreamDomain: 'egauge',
    documentation: 'https://www.home-assistant.io/integrations/egauge',
    integrationType: 'device',
    iotClass: 'local_polling',
    qualityScale: 'bronze',
    requirements: [
      'egauge-async==0.4.0',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@neggert',
    ],
    configFlow: true,
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual local endpoint setup',
        'snapshot, raw data, snapshotProvider, and injected native client operation',
        'generic HTTPS/HTTP local transport when config.path is supplied for an eGauge JSON endpoint',
      ],
      explicitUnsupported: [
        'claiming live command success without injected client.execute or commandExecutor',
        'Home Assistant credential validation through egauge-async without an injected client',
        'device-specific register semantics not represented by snapshot/rawData/client inputs',
      ],
    },
  },
};
