import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { NrgkickClient } from './nrgkick.classes.client.js';
import { NrgkickConfigFlow } from './nrgkick.classes.configflow.js';
import { createNrgkickDiscoveryDescriptor } from './nrgkick.discovery.js';
import type { INrgkickConfig } from './nrgkick.types.js';
import { nrgkickDomain, nrgkickProfile } from './nrgkick.types.js';

export class NrgkickIntegration extends SimpleLocalIntegration<INrgkickConfig> {
  public readonly domain = nrgkickDomain;
  public readonly discoveryDescriptor = createNrgkickDiscoveryDescriptor();
  public readonly configFlow = new NrgkickConfigFlow();

  constructor() {
    super(nrgkickProfile);
  }

  public async setup(configArg: INrgkickConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(nrgkickProfile, new NrgkickClient(configArg));
  }
}

export class HomeAssistantNrgkickIntegration extends NrgkickIntegration {}
