import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { KeeneticNdms2Client } from './keenetic_ndms2.classes.client.js';
import { KeeneticNdms2ConfigFlow } from './keenetic_ndms2.classes.configflow.js';
import { createKeeneticNdms2DiscoveryDescriptor } from './keenetic_ndms2.discovery.js';
import type { IKeeneticNdms2Config } from './keenetic_ndms2.types.js';
import { keeneticNdms2Domain, keeneticNdms2Profile } from './keenetic_ndms2.types.js';

export class KeeneticNdms2Integration extends SimpleLocalIntegration<IKeeneticNdms2Config> {
  public readonly domain = keeneticNdms2Domain;
  public readonly discoveryDescriptor = createKeeneticNdms2DiscoveryDescriptor();
  public readonly configFlow = new KeeneticNdms2ConfigFlow();

  constructor() {
    super(keeneticNdms2Profile);
  }

  public async setup(configArg: IKeeneticNdms2Config, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(keeneticNdms2Profile, new KeeneticNdms2Client(configArg));
  }
}

export class HomeAssistantKeeneticNdms2Integration extends KeeneticNdms2Integration {}
