import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { NukiClient } from './nuki.classes.client.js';
import { NukiConfigFlow } from './nuki.classes.configflow.js';
import { createNukiDiscoveryDescriptor } from './nuki.discovery.js';
import type { INukiConfig } from './nuki.types.js';
import { nukiDomain, nukiProfile } from './nuki.types.js';

export class NukiIntegration extends SimpleLocalIntegration<INukiConfig> {
  public readonly domain = nukiDomain;
  public readonly discoveryDescriptor = createNukiDiscoveryDescriptor();
  public readonly configFlow = new NukiConfigFlow();

  constructor() {
    super(nukiProfile);
  }

  public async setup(configArg: INukiConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(nukiProfile, new NukiClient(configArg));
  }
}

export class HomeAssistantNukiIntegration extends NukiIntegration {}
