import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { PencomClient } from './pencom.classes.client.js';
import { PencomConfigFlow } from './pencom.classes.configflow.js';
import { createPencomDiscoveryDescriptor } from './pencom.discovery.js';
import type { IPencomConfig } from './pencom.types.js';
import { pencomDomain, pencomProfile } from './pencom.types.js';

export class PencomIntegration extends SimpleLocalIntegration<IPencomConfig> {
  public readonly domain = pencomDomain;
  public readonly discoveryDescriptor = createPencomDiscoveryDescriptor();
  public readonly configFlow = new PencomConfigFlow();

  constructor() {
    super(pencomProfile);
  }

  public async setup(configArg: IPencomConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(pencomProfile, new PencomClient(configArg));
  }
}

export class HomeAssistantPencomIntegration extends PencomIntegration {}
