import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { EdimaxClient } from './edimax.classes.client.js';
import { EdimaxConfigFlow } from './edimax.classes.configflow.js';
import { createEdimaxDiscoveryDescriptor } from './edimax.discovery.js';
import type { IEdimaxConfig } from './edimax.types.js';
import { edimaxDomain, edimaxProfile } from './edimax.types.js';

export class EdimaxIntegration extends SimpleLocalIntegration<IEdimaxConfig> {
  public readonly domain = edimaxDomain;
  public readonly discoveryDescriptor = createEdimaxDiscoveryDescriptor();
  public readonly configFlow = new EdimaxConfigFlow();

  constructor() {
    super(edimaxProfile);
  }

  public async setup(configArg: IEdimaxConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(edimaxProfile, new EdimaxClient(configArg));
  }
}

export class HomeAssistantEdimaxIntegration extends EdimaxIntegration {}
