import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { OnewireClient } from './onewire.classes.client.js';
import { OnewireConfigFlow } from './onewire.classes.configflow.js';
import { createOnewireDiscoveryDescriptor } from './onewire.discovery.js';
import type { IOnewireConfig } from './onewire.types.js';
import { onewireDomain, onewireProfile } from './onewire.types.js';

export class OnewireIntegration extends SimpleLocalIntegration<IOnewireConfig> {
  public readonly domain = onewireDomain;
  public readonly discoveryDescriptor = createOnewireDiscoveryDescriptor();
  public readonly configFlow = new OnewireConfigFlow();

  constructor() {
    super(onewireProfile);
  }

  public async setup(configArg: IOnewireConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(onewireProfile, new OnewireClient(configArg));
  }
}

export class HomeAssistantOnewireIntegration extends OnewireIntegration {}
