import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LutronClient } from './lutron.classes.client.js';
import { LutronConfigFlow } from './lutron.classes.configflow.js';
import { createLutronDiscoveryDescriptor } from './lutron.discovery.js';
import type { ILutronConfig } from './lutron.types.js';
import { lutronDomain, lutronProfile } from './lutron.types.js';

export class LutronIntegration extends SimpleLocalIntegration<ILutronConfig> {
  public readonly domain = lutronDomain;
  public readonly discoveryDescriptor = createLutronDiscoveryDescriptor();
  public readonly configFlow = new LutronConfigFlow();

  constructor() {
    super(lutronProfile);
  }

  public async setup(configArg: ILutronConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(lutronProfile, new LutronClient(configArg));
  }
}

export class HomeAssistantLutronIntegration extends LutronIntegration {}
