import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { IronOsClient } from './iron_os.classes.client.js';
import { IronOsConfigFlow } from './iron_os.classes.configflow.js';
import { createIronOsDiscoveryDescriptor } from './iron_os.discovery.js';
import type { IIronOsConfig } from './iron_os.types.js';
import { ironOsDomain, ironOsProfile } from './iron_os.types.js';

export class IronOsIntegration extends SimpleLocalIntegration<IIronOsConfig> {
  public readonly domain = ironOsDomain;
  public readonly discoveryDescriptor = createIronOsDiscoveryDescriptor();
  public readonly configFlow = new IronOsConfigFlow();

  constructor() {
    super(ironOsProfile);
  }

  public async setup(configArg: IIronOsConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(ironOsProfile, new IronOsClient(configArg));
  }
}

export class HomeAssistantIronOsIntegration extends IronOsIntegration {}
