import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MedcomBleClient } from './medcom_ble.classes.client.js';
import { MedcomBleConfigFlow } from './medcom_ble.classes.configflow.js';
import { createMedcomBleDiscoveryDescriptor } from './medcom_ble.discovery.js';
import type { IMedcomBleConfig } from './medcom_ble.types.js';
import { medcomBleDomain, medcomBleProfile } from './medcom_ble.types.js';

export class MedcomBleIntegration extends SimpleLocalIntegration<IMedcomBleConfig> {
  public readonly domain = medcomBleDomain;
  public readonly discoveryDescriptor = createMedcomBleDiscoveryDescriptor();
  public readonly configFlow = new MedcomBleConfigFlow();

  constructor() {
    super(medcomBleProfile);
  }

  public async setup(configArg: IMedcomBleConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(medcomBleProfile, new MedcomBleClient(configArg));
  }
}
