import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LibreHardwareMonitorClient } from './libre_hardware_monitor.classes.client.js';
import { LibreHardwareMonitorConfigFlow } from './libre_hardware_monitor.classes.configflow.js';
import { createLibreHardwareMonitorDiscoveryDescriptor } from './libre_hardware_monitor.discovery.js';
import type { ILibreHardwareMonitorConfig } from './libre_hardware_monitor.types.js';
import { libreHardwareMonitorDomain, libreHardwareMonitorProfile } from './libre_hardware_monitor.types.js';

export class LibreHardwareMonitorIntegration extends SimpleLocalIntegration<ILibreHardwareMonitorConfig> {
  public readonly domain = libreHardwareMonitorDomain;
  public readonly discoveryDescriptor = createLibreHardwareMonitorDiscoveryDescriptor();
  public readonly configFlow = new LibreHardwareMonitorConfigFlow();

  constructor() {
    super(libreHardwareMonitorProfile);
  }

  public override async setup(configArg: ILibreHardwareMonitorConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(libreHardwareMonitorProfile, new LibreHardwareMonitorClient(configArg));
  }
}

export class HomeAssistantLibreHardwareMonitorIntegration extends LibreHardwareMonitorIntegration {}
