import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { KaleidescapeClient } from './kaleidescape.classes.client.js';
import { KaleidescapeConfigFlow } from './kaleidescape.classes.configflow.js';
import { createKaleidescapeDiscoveryDescriptor } from './kaleidescape.discovery.js';
import type { IKaleidescapeConfig } from './kaleidescape.types.js';
import { kaleidescapeDomain, kaleidescapeProfile } from './kaleidescape.types.js';

export class KaleidescapeIntegration extends SimpleLocalIntegration<IKaleidescapeConfig> {
  public readonly domain = kaleidescapeDomain;
  public readonly discoveryDescriptor = createKaleidescapeDiscoveryDescriptor();
  public readonly configFlow = new KaleidescapeConfigFlow();

  constructor() {
    super(kaleidescapeProfile);
  }

  public async setup(configArg: IKaleidescapeConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(kaleidescapeProfile, new KaleidescapeClient(configArg));
  }
}

export class HomeAssistantKaleidescapeIntegration extends KaleidescapeIntegration {}
