import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { GeniushubClient } from './geniushub.classes.client.js';
import { GeniushubConfigFlow } from './geniushub.classes.configflow.js';
import { createGeniushubDiscoveryDescriptor } from './geniushub.discovery.js';
import type { IGeniushubConfig } from './geniushub.types.js';
import { geniushubDomain, geniushubProfile } from './geniushub.types.js';

export class GeniushubIntegration extends SimpleLocalIntegration<IGeniushubConfig> {
  public readonly domain = geniushubDomain;
  public readonly discoveryDescriptor = createGeniushubDiscoveryDescriptor();
  public readonly configFlow = new GeniushubConfigFlow();

  constructor() {
    super(geniushubProfile);
  }

  public async setup(configArg: IGeniushubConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(geniushubProfile, new GeniushubClient(configArg));
  }
}

export class HomeAssistantGeniushubIntegration extends GeniushubIntegration {}
