import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { EmulatedKasaClient } from './emulated_kasa.classes.client.js';
import { EmulatedKasaConfigFlow } from './emulated_kasa.classes.configflow.js';
import { createEmulatedKasaDiscoveryDescriptor } from './emulated_kasa.discovery.js';
import type { IEmulatedKasaConfig } from './emulated_kasa.types.js';
import { emulatedKasaDomain, emulatedKasaProfile } from './emulated_kasa.types.js';

export class EmulatedKasaIntegration extends SimpleLocalIntegration<IEmulatedKasaConfig> {
  public readonly domain = emulatedKasaDomain;
  public readonly discoveryDescriptor = createEmulatedKasaDiscoveryDescriptor();
  public readonly configFlow = new EmulatedKasaConfigFlow();

  constructor() {
    super(emulatedKasaProfile);
  }

  public async setup(configArg: IEmulatedKasaConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(emulatedKasaProfile, new EmulatedKasaClient(configArg));
  }
}

export class HomeAssistantEmulatedKasaIntegration extends EmulatedKasaIntegration {}
