import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { FibaroClient } from './fibaro.classes.client.js';
import { FibaroConfigFlow } from './fibaro.classes.configflow.js';
import { createFibaroDiscoveryDescriptor } from './fibaro.discovery.js';
import type { IFibaroConfig } from './fibaro.types.js';
import { fibaroDomain, fibaroProfile } from './fibaro.types.js';

export class FibaroIntegration extends SimpleLocalIntegration<IFibaroConfig> {
  public readonly domain = fibaroDomain;
  public readonly discoveryDescriptor = createFibaroDiscoveryDescriptor();
  public readonly configFlow = new FibaroConfigFlow();

  constructor() {
    super(fibaroProfile);
  }

  public async setup(configArg: IFibaroConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(fibaroProfile, new FibaroClient(configArg));
  }
}

export class HomeAssistantFibaroIntegration extends FibaroIntegration {}
