import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { NoboHubClient } from './nobo_hub.classes.client.js';
import { NoboHubConfigFlow } from './nobo_hub.classes.configflow.js';
import { createNoboHubDiscoveryDescriptor } from './nobo_hub.discovery.js';
import type { INoboHubConfig } from './nobo_hub.types.js';
import { noboHubDomain, noboHubProfile } from './nobo_hub.types.js';

export class NoboHubIntegration extends SimpleLocalIntegration<INoboHubConfig> {
  public readonly domain = noboHubDomain;
  public readonly discoveryDescriptor = createNoboHubDiscoveryDescriptor();
  public readonly configFlow = new NoboHubConfigFlow();

  constructor() {
    super(noboHubProfile);
  }

  public async setup(configArg: INoboHubConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(noboHubProfile, new NoboHubClient(configArg));
  }
}

export class HomeAssistantNoboHubIntegration extends NoboHubIntegration {}
