import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { NibeHeatpumpClient } from './nibe_heatpump.classes.client.js';
import { NibeHeatpumpConfigFlow } from './nibe_heatpump.classes.configflow.js';
import { createNibeHeatpumpDiscoveryDescriptor } from './nibe_heatpump.discovery.js';
import type { INibeHeatpumpConfig } from './nibe_heatpump.types.js';
import { nibeHeatpumpDomain, nibeHeatpumpProfile } from './nibe_heatpump.types.js';

export class NibeHeatpumpIntegration extends SimpleLocalIntegration<INibeHeatpumpConfig> {
  public readonly domain = nibeHeatpumpDomain;
  public readonly discoveryDescriptor = createNibeHeatpumpDiscoveryDescriptor();
  public readonly configFlow = new NibeHeatpumpConfigFlow();

  constructor() {
    super(nibeHeatpumpProfile);
  }

  public override async setup(configArg: INibeHeatpumpConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(nibeHeatpumpProfile, new NibeHeatpumpClient(configArg));
  }
}

export class HomeAssistantNibeHeatpumpIntegration extends NibeHeatpumpIntegration {}
