import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { NadClient } from './nad.classes.client.js';
import { NadConfigFlow } from './nad.classes.configflow.js';
import { createNadDiscoveryDescriptor } from './nad.discovery.js';
import type { INadConfig } from './nad.types.js';
import { nadDomain, nadProfile } from './nad.types.js';

export class NadIntegration extends SimpleLocalIntegration<INadConfig> {
  public readonly domain = nadDomain;
  public readonly discoveryDescriptor = createNadDiscoveryDescriptor();
  public readonly configFlow = new NadConfigFlow();

  constructor() {
    super(nadProfile);
  }

  public async setup(configArg: INadConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(nadProfile, new NadClient(configArg));
  }
}

export class HomeAssistantNadIntegration extends NadIntegration {}
