import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { EnoceanClient } from './enocean.classes.client.js';
import { EnoceanConfigFlow } from './enocean.classes.configflow.js';
import { createEnoceanDiscoveryDescriptor } from './enocean.discovery.js';
import type { IEnoceanConfig } from './enocean.types.js';
import { enoceanDomain, enoceanProfile } from './enocean.types.js';

export class EnoceanIntegration extends SimpleLocalIntegration<IEnoceanConfig> {
  public readonly domain = enoceanDomain;
  public readonly discoveryDescriptor = createEnoceanDiscoveryDescriptor();
  public readonly configFlow = new EnoceanConfigFlow();

  constructor() {
    super(enoceanProfile);
  }

  public async setup(configArg: IEnoceanConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(enoceanProfile, new EnoceanClient(configArg));
  }
}

export class HomeAssistantEnoceanIntegration extends EnoceanIntegration {}
