import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { PhilipsJsClient } from './philips_js.classes.client.js';
import { PhilipsJsConfigFlow } from './philips_js.classes.configflow.js';
import { createPhilipsJsDiscoveryDescriptor } from './philips_js.discovery.js';
import type { IPhilipsJsConfig } from './philips_js.types.js';
import { philipsJsDomain, philipsJsProfile } from './philips_js.types.js';

export class PhilipsJsIntegration extends SimpleLocalIntegration<IPhilipsJsConfig> {
  public readonly domain = philipsJsDomain;
  public readonly discoveryDescriptor = createPhilipsJsDiscoveryDescriptor();
  public readonly configFlow = new PhilipsJsConfigFlow();

  constructor() {
    super(philipsJsProfile);
  }

  public async setup(configArg: IPhilipsJsConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(philipsJsProfile, new PhilipsJsClient(configArg));
  }
}

export class HomeAssistantPhilipsJsIntegration extends PhilipsJsIntegration {}
