import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { PingClient } from './ping.classes.client.js';
import { PingConfigFlow } from './ping.classes.configflow.js';
import { createPingDiscoveryDescriptor } from './ping.discovery.js';
import type { IPingConfig } from './ping.types.js';
import { pingDomain, pingProfile } from './ping.types.js';

export class PingIntegration extends SimpleLocalIntegration<IPingConfig> {
  public readonly domain = pingDomain;
  public readonly discoveryDescriptor = createPingDiscoveryDescriptor();
  public readonly configFlow = new PingConfigFlow();

  constructor() {
    super(pingProfile);
  }

  public override async setup(configArg: IPingConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(pingProfile, new PingClient(configArg));
  }
}

export class HomeAssistantPingIntegration extends PingIntegration {}
