import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MjpegClient } from './mjpeg.classes.client.js';
import { MjpegConfigFlow } from './mjpeg.classes.configflow.js';
import { createMjpegDiscoveryDescriptor } from './mjpeg.discovery.js';
import type { IMjpegConfig } from './mjpeg.types.js';
import { mjpegDomain, mjpegProfile } from './mjpeg.types.js';

export class MjpegIntegration extends SimpleLocalIntegration<IMjpegConfig> {
  public readonly domain = mjpegDomain;
  public readonly discoveryDescriptor = createMjpegDiscoveryDescriptor();
  public readonly configFlow = new MjpegConfigFlow();

  constructor() {
    super(mjpegProfile);
  }

  public async setup(configArg: IMjpegConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(mjpegProfile, new MjpegClient(configArg));
  }
}

export class HomeAssistantMjpegIntegration extends MjpegIntegration {}
