import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { NetioClient } from './netio.classes.client.js';
import { NetioConfigFlow } from './netio.classes.configflow.js';
import { createNetioDiscoveryDescriptor } from './netio.discovery.js';
import type { INetioConfig } from './netio.types.js';
import { netioDomain, netioProfile } from './netio.types.js';

export class NetioIntegration extends SimpleLocalIntegration<INetioConfig> {
  public readonly domain = netioDomain;
  public readonly discoveryDescriptor = createNetioDiscoveryDescriptor();
  public readonly configFlow = new NetioConfigFlow();

  constructor() {
    super(netioProfile);
  }

  public override async setup(configArg: INetioConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(netioProfile, new NetioClient(configArg));
  }
}

export class HomeAssistantNetioIntegration extends NetioIntegration {}
