import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { IskraClient } from './iskra.classes.client.js';
import { IskraConfigFlow } from './iskra.classes.configflow.js';
import { createIskraDiscoveryDescriptor } from './iskra.discovery.js';
import type { IIskraConfig } from './iskra.types.js';
import { iskraDomain, iskraProfile } from './iskra.types.js';

export class IskraIntegration extends SimpleLocalIntegration<IIskraConfig> {
  public readonly domain = iskraDomain;
  public readonly discoveryDescriptor = createIskraDiscoveryDescriptor();
  public readonly configFlow = new IskraConfigFlow();

  constructor() {
    super(iskraProfile);
  }

  public async setup(configArg: IIskraConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(iskraProfile, new IskraClient(configArg));
  }
}

export class HomeAssistantIskraIntegration extends IskraIntegration {}
