import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { KioskerClient } from './kiosker.classes.client.js';
import { KioskerConfigFlow } from './kiosker.classes.configflow.js';
import { createKioskerDiscoveryDescriptor } from './kiosker.discovery.js';
import type { IKioskerConfig } from './kiosker.types.js';
import { kioskerDomain, kioskerProfile } from './kiosker.types.js';

export class KioskerIntegration extends SimpleLocalIntegration<IKioskerConfig> {
  public readonly domain = kioskerDomain;
  public readonly discoveryDescriptor = createKioskerDiscoveryDescriptor();
  public readonly configFlow = new KioskerConfigFlow();

  constructor() {
    super(kioskerProfile);
  }

  public async setup(configArg: IKioskerConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(kioskerProfile, new KioskerClient(configArg));
  }
}
