import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { EmulatedHueClient } from './emulated_hue.classes.client.js';
import { EmulatedHueConfigFlow } from './emulated_hue.classes.configflow.js';
import { createEmulatedHueDiscoveryDescriptor } from './emulated_hue.discovery.js';
import type { IEmulatedHueConfig } from './emulated_hue.types.js';
import { emulatedHueDomain, emulatedHueProfile } from './emulated_hue.types.js';

export class EmulatedHueIntegration extends SimpleLocalIntegration<IEmulatedHueConfig> {
  public readonly domain = emulatedHueDomain;
  public readonly discoveryDescriptor = createEmulatedHueDiscoveryDescriptor();
  public readonly configFlow = new EmulatedHueConfigFlow();

  constructor() {
    super(emulatedHueProfile);
  }

  public async setup(configArg: IEmulatedHueConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(emulatedHueProfile, new EmulatedHueClient(configArg));
  }
}

export class HomeAssistantEmulatedHueIntegration extends EmulatedHueIntegration {}
