import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MqttEventstreamClient } from './mqtt_eventstream.classes.client.js';
import { MqttEventstreamConfigFlow } from './mqtt_eventstream.classes.configflow.js';
import { createMqttEventstreamDiscoveryDescriptor } from './mqtt_eventstream.discovery.js';
import type { IMqttEventstreamConfig } from './mqtt_eventstream.types.js';
import { mqttEventstreamDomain, mqttEventstreamProfile } from './mqtt_eventstream.types.js';

export class MqttEventstreamIntegration extends SimpleLocalIntegration<IMqttEventstreamConfig> {
  public readonly domain = mqttEventstreamDomain;
  public readonly discoveryDescriptor = createMqttEventstreamDiscoveryDescriptor();
  public readonly configFlow = new MqttEventstreamConfigFlow();

  constructor() {
    super(mqttEventstreamProfile);
  }

  public async setup(configArg: IMqttEventstreamConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(mqttEventstreamProfile, new MqttEventstreamClient(configArg));
  }
}

export class HomeAssistantMqttEventstreamIntegration extends MqttEventstreamIntegration {}
