import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { HegelClient } from './hegel.classes.client.js';
import { HegelConfigFlow } from './hegel.classes.configflow.js';
import { createHegelDiscoveryDescriptor } from './hegel.discovery.js';
import type { IHegelConfig } from './hegel.types.js';
import { hegelDomain, hegelProfile } from './hegel.types.js';

export class HegelIntegration extends SimpleLocalIntegration<IHegelConfig> {
  public readonly domain = hegelDomain;
  public readonly discoveryDescriptor = createHegelDiscoveryDescriptor();
  public readonly configFlow = new HegelConfigFlow();

  constructor() {
    super(hegelProfile);
  }

  public async setup(configArg: IHegelConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(hegelProfile, new HegelClient(configArg));
  }
}

export class HomeAssistantHegelIntegration extends HegelIntegration {}
