import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { NaswebClient } from './nasweb.classes.client.js';
import { NaswebConfigFlow } from './nasweb.classes.configflow.js';
import { createNaswebDiscoveryDescriptor } from './nasweb.discovery.js';
import type { INaswebConfig } from './nasweb.types.js';
import { naswebDomain, naswebProfile } from './nasweb.types.js';

export class NaswebIntegration extends SimpleLocalIntegration<INaswebConfig> {
  public readonly domain = naswebDomain;
  public readonly discoveryDescriptor = createNaswebDiscoveryDescriptor();
  public readonly configFlow = new NaswebConfigFlow();

  constructor() {
    super(naswebProfile);
  }

  public async setup(configArg: INaswebConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(naswebProfile, new NaswebClient(configArg));
  }
}

export class HomeAssistantNaswebIntegration extends NaswebIntegration {}
