import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { NikoHomeControlClient } from './niko_home_control.classes.client.js';
import { NikoHomeControlConfigFlow } from './niko_home_control.classes.configflow.js';
import { createNikoHomeControlDiscoveryDescriptor } from './niko_home_control.discovery.js';
import type { INikoHomeControlConfig } from './niko_home_control.types.js';
import { nikoHomeControlDomain, nikoHomeControlProfile } from './niko_home_control.types.js';

export class NikoHomeControlIntegration extends SimpleLocalIntegration<INikoHomeControlConfig> {
  public readonly domain = nikoHomeControlDomain;
  public readonly discoveryDescriptor = createNikoHomeControlDiscoveryDescriptor();
  public readonly configFlow = new NikoHomeControlConfigFlow();

  constructor() {
    super(nikoHomeControlProfile);
  }

  public override async setup(configArg: INikoHomeControlConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(nikoHomeControlProfile, new NikoHomeControlClient(configArg));
  }
}

export class HomeAssistantNikoHomeControlIntegration extends NikoHomeControlIntegration {}
