import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LgSoundbarClient } from './lg_soundbar.classes.client.js';
import { LgSoundbarConfigFlow } from './lg_soundbar.classes.configflow.js';
import { createLgSoundbarDiscoveryDescriptor } from './lg_soundbar.discovery.js';
import type { ILgSoundbarConfig } from './lg_soundbar.types.js';
import { lgSoundbarDomain, lgSoundbarProfile } from './lg_soundbar.types.js';

export class LgSoundbarIntegration extends SimpleLocalIntegration<ILgSoundbarConfig> {
  public readonly domain = lgSoundbarDomain;
  public readonly discoveryDescriptor = createLgSoundbarDiscoveryDescriptor();
  public readonly configFlow = new LgSoundbarConfigFlow();

  constructor() {
    super(lgSoundbarProfile);
  }

  public override async setup(configArg: ILgSoundbarConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(lgSoundbarProfile, new LgSoundbarClient(configArg));
  }
}

export class HomeAssistantLgSoundbarIntegration extends LgSoundbarIntegration {}
