import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LgNetcastClient } from './lg_netcast.classes.client.js';
import { LgNetcastConfigFlow } from './lg_netcast.classes.configflow.js';
import { createLgNetcastDiscoveryDescriptor } from './lg_netcast.discovery.js';
import type { ILgNetcastConfig } from './lg_netcast.types.js';
import { lgNetcastDomain, lgNetcastProfile } from './lg_netcast.types.js';

export class LgNetcastIntegration extends SimpleLocalIntegration<ILgNetcastConfig> {
  public readonly domain = lgNetcastDomain;
  public readonly discoveryDescriptor = createLgNetcastDiscoveryDescriptor();
  public readonly configFlow = new LgNetcastConfigFlow();

  constructor() {
    super(lgNetcastProfile);
  }

  public override async setup(configArg: ILgNetcastConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(lgNetcastProfile, new LgNetcastClient(configArg));
  }
}

export class HomeAssistantLgNetcastIntegration extends LgNetcastIntegration {}
