import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LuciClient } from './luci.classes.client.js';
import { LuciConfigFlow } from './luci.classes.configflow.js';
import { createLuciDiscoveryDescriptor } from './luci.discovery.js';
import type { ILuciConfig } from './luci.types.js';
import { luciDomain, luciProfile } from './luci.types.js';

export class LuciIntegration extends SimpleLocalIntegration<ILuciConfig> {
  public readonly domain = luciDomain;
  public readonly discoveryDescriptor = createLuciDiscoveryDescriptor();
  public readonly configFlow = new LuciConfigFlow();

  constructor() {
    super(luciProfile);
  }

  public async setup(configArg: ILuciConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(luciProfile, new LuciClient(configArg));
  }
}
