import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LcnClient } from './lcn.classes.client.js';
import { LcnConfigFlow } from './lcn.classes.configflow.js';
import { createLcnDiscoveryDescriptor } from './lcn.discovery.js';
import type { ILcnConfig } from './lcn.types.js';
import { lcnDomain, lcnProfile } from './lcn.types.js';

export class LcnIntegration extends SimpleLocalIntegration<ILcnConfig> {
  public readonly domain = lcnDomain;
  public readonly discoveryDescriptor = createLcnDiscoveryDescriptor();
  public readonly configFlow = new LcnConfigFlow();

  constructor() {
    super(lcnProfile);
  }

  public async setup(configArg: ILcnConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(lcnProfile, new LcnClient(configArg));
  }
}

export class HomeAssistantLcnIntegration extends LcnIntegration {}
