import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { Edl21Client } from './edl21.classes.client.js';
import { Edl21ConfigFlow } from './edl21.classes.configflow.js';
import { createEdl21DiscoveryDescriptor } from './edl21.discovery.js';
import type { IEdl21Config } from './edl21.types.js';
import { edl21Domain, edl21Profile } from './edl21.types.js';

export class Edl21Integration extends SimpleLocalIntegration<IEdl21Config> {
  public readonly domain = edl21Domain;
  public readonly discoveryDescriptor = createEdl21DiscoveryDescriptor();
  public readonly configFlow = new Edl21ConfigFlow();

  constructor() {
    super(edl21Profile);
  }

  public async setup(configArg: IEdl21Config, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(edl21Profile, new Edl21Client(configArg));
  }
}

export class HomeAssistantEdl21Integration extends Edl21Integration {}
