import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MonopriceClient } from './monoprice.classes.client.js';
import { MonopriceConfigFlow } from './monoprice.classes.configflow.js';
import { createMonopriceDiscoveryDescriptor } from './monoprice.discovery.js';
import type { IMonopriceConfig } from './monoprice.types.js';
import { monopriceDomain, monopriceProfile } from './monoprice.types.js';

export class MonopriceIntegration extends SimpleLocalIntegration<IMonopriceConfig> {
  public readonly domain = monopriceDomain;
  public readonly discoveryDescriptor = createMonopriceDiscoveryDescriptor();
  public readonly configFlow = new MonopriceConfigFlow();

  constructor() {
    super(monopriceProfile);
  }

  public async setup(configArg: IMonopriceConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(monopriceProfile, new MonopriceClient(configArg));
  }
}

export class HomeAssistantMonopriceIntegration extends MonopriceIntegration {}
