import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LookinClient } from './lookin.classes.client.js';
import { LookinConfigFlow } from './lookin.classes.configflow.js';
import { createLookinDiscoveryDescriptor } from './lookin.discovery.js';
import type { ILookinConfig } from './lookin.types.js';
import { lookinDomain, lookinProfile } from './lookin.types.js';

export class LookinIntegration extends SimpleLocalIntegration<ILookinConfig> {
  public readonly domain = lookinDomain;
  public readonly discoveryDescriptor = createLookinDiscoveryDescriptor();
  public readonly configFlow = new LookinConfigFlow();

  constructor() {
    super(lookinProfile);
  }

  public async setup(configArg: ILookinConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(lookinProfile, new LookinClient(configArg));
  }
}

export class HomeAssistantLookinIntegration extends LookinIntegration {}
