import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MediaroomClient } from './mediaroom.classes.client.js';
import { MediaroomConfigFlow } from './mediaroom.classes.configflow.js';
import { createMediaroomDiscoveryDescriptor } from './mediaroom.discovery.js';
import type { IMediaroomConfig } from './mediaroom.types.js';
import { mediaroomDomain, mediaroomProfile } from './mediaroom.types.js';

export class MediaroomIntegration extends SimpleLocalIntegration<IMediaroomConfig> {
  public readonly domain = mediaroomDomain;
  public readonly discoveryDescriptor = createMediaroomDiscoveryDescriptor();
  public readonly configFlow = new MediaroomConfigFlow();

  constructor() {
    super(mediaroomProfile);
  }

  public async setup(configArg: IMediaroomConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(mediaroomProfile, new MediaroomClient(configArg));
  }
}
