import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MfiClient } from './mfi.classes.client.js';
import { MfiConfigFlow } from './mfi.classes.configflow.js';
import { createMfiDiscoveryDescriptor } from './mfi.discovery.js';
import type { IMfiConfig } from './mfi.types.js';
import { mfiDomain, mfiProfile } from './mfi.types.js';

export class MfiIntegration extends SimpleLocalIntegration<IMfiConfig> {
  public readonly domain = mfiDomain;
  public readonly discoveryDescriptor = createMfiDiscoveryDescriptor();
  public readonly configFlow = new MfiConfigFlow();

  constructor() {
    super(mfiProfile);
  }

  public async setup(configArg: IMfiConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(mfiProfile, new MfiClient(configArg));
  }
}
