import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { GoveeBleClient } from './govee_ble.classes.client.js';
import { GoveeBleConfigFlow } from './govee_ble.classes.configflow.js';
import { createGoveeBleDiscoveryDescriptor } from './govee_ble.discovery.js';
import type { IGoveeBleConfig } from './govee_ble.types.js';
import { goveeBleDomain, goveeBleProfile } from './govee_ble.types.js';

export class GoveeBleIntegration extends SimpleLocalIntegration<IGoveeBleConfig> {
  public readonly domain = goveeBleDomain;
  public readonly discoveryDescriptor = createGoveeBleDiscoveryDescriptor();
  public readonly configFlow = new GoveeBleConfigFlow();

  constructor() {
    super(goveeBleProfile);
  }

  public async setup(configArg: IGoveeBleConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(goveeBleProfile, new GoveeBleClient(configArg));
  }
}

export class HomeAssistantGoveeBleIntegration extends GoveeBleIntegration {}
