import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { OverkizClient } from './overkiz.classes.client.js';
import { OverkizConfigFlow } from './overkiz.classes.configflow.js';
import { createOverkizDiscoveryDescriptor } from './overkiz.discovery.js';
import type { IOverkizConfig } from './overkiz.types.js';
import { overkizDomain, overkizProfile } from './overkiz.types.js';

export class OverkizIntegration extends SimpleLocalIntegration<IOverkizConfig> {
  public readonly domain = overkizDomain;
  public readonly discoveryDescriptor = createOverkizDiscoveryDescriptor();
  public readonly configFlow = new OverkizConfigFlow();

  constructor() {
    super(overkizProfile);
  }

  public override async setup(configArg: IOverkizConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(overkizProfile, new OverkizClient(configArg));
  }
}

export class HomeAssistantOverkizIntegration extends OverkizIntegration {}
