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

export const emulatedKasaDomain = 'emulated_kasa';
export const emulatedKasaDefaultName = 'Emulated Kasa';

export type TEmulatedKasaRawData = TSimpleLocalRawData;
export interface IEmulatedKasaSnapshot extends ISimpleLocalSnapshot {}
export interface IEmulatedKasaConfig extends ISimpleLocalConfig {}
export interface IHomeAssistantEmulatedKasaConfig extends IEmulatedKasaConfig {}

export const emulatedKasaProfile: ISimpleLocalIntegrationProfile = {
  domain: 'emulated_kasa',
  displayName: 'Emulated Kasa',
  manufacturer: 'Home Assistant',
  model: 'TP-Link Kasa Emulator',
  defaultName: emulatedKasaDefaultName,
  defaultPort: 9999,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'sensor',
    'binary_sensor',
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    'emulated kasa',
    'kasa',
    'tp-link',
    'tplink',
    'sense energy',
    'power',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/emulated_kasa',
    upstreamDomain: 'emulated_kasa',
    iotClass: 'local_push',
    qualityScale: 'internal',
    requirements: [
      'sense-energy==0.14.1',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@kbickar',
    ],
    configFlow: false,
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
        'binary_sensor',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual local setup for configured HA entities exposed as emulated Kasa plug power snapshots',
        'snapshot, raw data, snapshotProvider, and injected native client operation',
      ],
      explicitUnsupported: [
        'claiming live Kasa emulation server startup or UDP discovery without an injected native client',
        'claiming live command success without injected client.execute or commandExecutor',
        'Sense Energy cloud account operations',
      ],
    },
  },
};
