import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { OemClient } from './oem.classes.client.js';
import { OemConfigFlow } from './oem.classes.configflow.js';
import { createOemDiscoveryDescriptor } from './oem.discovery.js';
import type { IOemConfig } from './oem.types.js';
import { oemDomain, oemProfile } from './oem.types.js';

export class OemIntegration extends SimpleLocalIntegration<IOemConfig> {
  public readonly domain = oemDomain;
  public readonly discoveryDescriptor = createOemDiscoveryDescriptor();
  public readonly configFlow = new OemConfigFlow();

  constructor() {
    super(oemProfile);
  }

  public async setup(configArg: IOemConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(oemProfile, new OemClient(configArg));
  }
}

export class HomeAssistantOemIntegration extends OemIntegration {}
