import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { OpenhardwaremonitorClient } from './openhardwaremonitor.classes.client.js';
import { OpenhardwaremonitorConfigFlow } from './openhardwaremonitor.classes.configflow.js';
import { createOpenhardwaremonitorDiscoveryDescriptor } from './openhardwaremonitor.discovery.js';
import type { IOpenhardwaremonitorConfig } from './openhardwaremonitor.types.js';
import { openhardwaremonitorDomain, openhardwaremonitorProfile } from './openhardwaremonitor.types.js';

export class OpenhardwaremonitorIntegration extends SimpleLocalIntegration<IOpenhardwaremonitorConfig> {
  public readonly domain = openhardwaremonitorDomain;
  public readonly discoveryDescriptor = createOpenhardwaremonitorDiscoveryDescriptor();
  public readonly configFlow = new OpenhardwaremonitorConfigFlow();

  constructor() {
    super(openhardwaremonitorProfile);
  }

  public override async setup(configArg: IOpenhardwaremonitorConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(openhardwaremonitorProfile, new OpenhardwaremonitorClient(configArg));
  }
}

export class HomeAssistantOpenhardwaremonitorIntegration extends OpenhardwaremonitorIntegration {}
