import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { KefClient } from './kef.classes.client.js';
import { KefConfigFlow } from './kef.classes.configflow.js';
import { createKefDiscoveryDescriptor } from './kef.discovery.js';
import type { IKefConfig } from './kef.types.js';
import { kefDomain, kefProfile } from './kef.types.js';

export class KefIntegration extends SimpleLocalIntegration<IKefConfig> {
  public readonly domain = kefDomain;
  public readonly discoveryDescriptor = createKefDiscoveryDescriptor();
  public readonly configFlow = new KefConfigFlow();

  constructor() {
    super(kefProfile);
  }

  public async setup(configArg: IKefConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(kefProfile, new KefClient(configArg));
  }
}

export class HomeAssistantKefIntegration extends KefIntegration {}
