import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { NamClient } from './nam.classes.client.js';
import { NamConfigFlow } from './nam.classes.configflow.js';
import { createNamDiscoveryDescriptor } from './nam.discovery.js';
import type { INamConfig } from './nam.types.js';
import { namDomain, namProfile } from './nam.types.js';

export class NamIntegration extends SimpleLocalIntegration<INamConfig> {
  public readonly domain = namDomain;
  public readonly discoveryDescriptor = createNamDiscoveryDescriptor();
  public readonly configFlow = new NamConfigFlow();

  constructor() {
    super(namProfile);
  }

  public async setup(configArg: INamConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(namProfile, new NamClient(configArg));
  }
}

export class HomeAssistantNamIntegration extends NamIntegration {}
