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

export const energeniePowerSocketsDomain = 'energenie_power_sockets';
export const energeniePowerSocketsDefaultName = 'Energenie Power Sockets';

export type TEnergeniePowerSocketsRawData = TSimpleLocalRawData;
export interface IEnergeniePowerSocketsSnapshot extends ISimpleLocalSnapshot {}
export interface IEnergeniePowerSocketsConfig extends ISimpleLocalConfig {
  deviceApiId?: string;
  numberOfSockets?: number;
}
export interface IHomeAssistantEnergeniePowerSocketsConfig extends IEnergeniePowerSocketsConfig {}

export const energeniePowerSocketsProfile: ISimpleLocalIntegrationProfile = {
  domain: 'energenie_power_sockets',
  displayName: 'Energenie Power Sockets',
  manufacturer: 'Energenie',
  model: 'PowerStrip USB',
  defaultName: energeniePowerSocketsDefaultName,
  defaultProtocol: 'local',
  status: 'control-runtime',
  platforms: [
    'switch',
  ],
  serviceDomains: [
    'switch',
  ],
  controlServices: [
    'turn_on',
    'turn_off',
    'toggle',
  ],
  discoverySources: [
    'manual',
    'usb',
    'custom',
  ],
  discoveryKeywords: [
    'energenie',
    'power sockets',
    'powerstrip',
    'pyegps',
    'usb',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/energenie_power_sockets',
    upstreamDomain: 'energenie_power_sockets',
    integrationType: 'device',
    iotClass: 'local_polling',
    qualityScale: undefined,
    requirements: [
      'pyegps==0.2.5',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@gnumpi',
    ],
    configFlow: true,
    runtime: {
      type: 'control-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'turn_on',
        'turn_off',
        'toggle',
      ],
      platforms: [
        'switch',
      ],
      controls: true,
    },
    localApi: {
      implemented: [
        'manual local USB power-strip setup from raw pyegps-style snapshots',
        'snapshot, raw data, snapshotProvider, and injected native client operation',
        'executor-routed socket switch control when client.execute or commandExecutor is supplied',
      ],
      explicitUnsupported: [
        'claiming live socket switch success without injected client.execute or commandExecutor',
        'direct pyegps USB access without an injected native client',
      ],
    },
  },
};
