import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { EnergeniePowerSocketsClient } from './energenie_power_sockets.classes.client.js';
import { EnergeniePowerSocketsConfigFlow } from './energenie_power_sockets.classes.configflow.js';
import { createEnergeniePowerSocketsDiscoveryDescriptor } from './energenie_power_sockets.discovery.js';
import type { IEnergeniePowerSocketsConfig } from './energenie_power_sockets.types.js';
import { energeniePowerSocketsDomain, energeniePowerSocketsProfile } from './energenie_power_sockets.types.js';

export class EnergeniePowerSocketsIntegration extends SimpleLocalIntegration<IEnergeniePowerSocketsConfig> {
  public readonly domain = energeniePowerSocketsDomain;
  public readonly discoveryDescriptor = createEnergeniePowerSocketsDiscoveryDescriptor();
  public readonly configFlow = new EnergeniePowerSocketsConfigFlow();

  constructor() {
    super(energeniePowerSocketsProfile);
  }

  public async setup(configArg: IEnergeniePowerSocketsConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(energeniePowerSocketsProfile, new EnergeniePowerSocketsClient(configArg));
  }
}

export class HomeAssistantEnergeniePowerSocketsIntegration extends EnergeniePowerSocketsIntegration {}
