import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { Iperf3Client } from './iperf3.classes.client.js';
import { Iperf3ConfigFlow } from './iperf3.classes.configflow.js';
import { createIperf3DiscoveryDescriptor } from './iperf3.discovery.js';
import type { IIperf3Config } from './iperf3.types.js';
import { iperf3Domain, iperf3Profile } from './iperf3.types.js';

export class Iperf3Integration extends SimpleLocalIntegration<IIperf3Config> {
  public readonly domain = iperf3Domain;
  public readonly discoveryDescriptor = createIperf3DiscoveryDescriptor();
  public readonly configFlow = new Iperf3ConfigFlow();

  constructor() {
    super(iperf3Profile);
  }

  public async setup(configArg: IIperf3Config, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(iperf3Profile, new Iperf3Client(configArg));
  }
}

export class HomeAssistantIperf3Integration extends Iperf3Integration {}
