import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { HeatmiserClient } from './heatmiser.classes.client.js';
import { HeatmiserConfigFlow } from './heatmiser.classes.configflow.js';
import { createHeatmiserDiscoveryDescriptor } from './heatmiser.discovery.js';
import type { IHeatmiserConfig } from './heatmiser.types.js';
import { heatmiserDomain, heatmiserProfile } from './heatmiser.types.js';

export class HeatmiserIntegration extends SimpleLocalIntegration<IHeatmiserConfig> {
  public readonly domain = heatmiserDomain;
  public readonly discoveryDescriptor = createHeatmiserDiscoveryDescriptor();
  public readonly configFlow = new HeatmiserConfigFlow();

  constructor() {
    super(heatmiserProfile);
  }

  public async setup(configArg: IHeatmiserConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(heatmiserProfile, new HeatmiserClient(configArg));
  }
}

export class HomeAssistantHeatmiserIntegration extends HeatmiserIntegration {}
