import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LinuxBatteryClient } from './linux_battery.classes.client.js';
import { LinuxBatteryConfigFlow } from './linux_battery.classes.configflow.js';
import { createLinuxBatteryDiscoveryDescriptor } from './linux_battery.discovery.js';
import type { ILinuxBatteryConfig } from './linux_battery.types.js';
import { linuxBatteryDomain, linuxBatteryProfile } from './linux_battery.types.js';

export class LinuxBatteryIntegration extends SimpleLocalIntegration<ILinuxBatteryConfig> {
  public readonly domain = linuxBatteryDomain;
  public readonly discoveryDescriptor = createLinuxBatteryDiscoveryDescriptor();
  public readonly configFlow = new LinuxBatteryConfigFlow();

  constructor() {
    super(linuxBatteryProfile);
  }

  public override async setup(configArg: ILinuxBatteryConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(linuxBatteryProfile, new LinuxBatteryClient(configArg));
  }
}
