import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MycroftClient } from './mycroft.classes.client.js';
import { MycroftConfigFlow } from './mycroft.classes.configflow.js';
import { createMycroftDiscoveryDescriptor } from './mycroft.discovery.js';
import type { IMycroftConfig } from './mycroft.types.js';
import { mycroftDomain, mycroftProfile } from './mycroft.types.js';

export class MycroftIntegration extends SimpleLocalIntegration<IMycroftConfig> {
  public readonly domain = mycroftDomain;
  public readonly discoveryDescriptor = createMycroftDiscoveryDescriptor();
  public readonly configFlow = new MycroftConfigFlow();

  constructor() {
    super(mycroftProfile);
  }

  public async setup(configArg: IMycroftConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(mycroftProfile, new MycroftClient(configArg));
  }
}

export class HomeAssistantMycroftIntegration extends MycroftIntegration {}
