import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { OmbiClient } from './ombi.classes.client.js';
import { OmbiConfigFlow } from './ombi.classes.configflow.js';
import { createOmbiDiscoveryDescriptor } from './ombi.discovery.js';
import type { IOmbiConfig } from './ombi.types.js';
import { ombiDomain, ombiProfile } from './ombi.types.js';

export class OmbiIntegration extends SimpleLocalIntegration<IOmbiConfig> {
  public readonly domain = ombiDomain;
  public readonly discoveryDescriptor = createOmbiDiscoveryDescriptor();
  public readonly configFlow = new OmbiConfigFlow();

  constructor() {
    super(ombiProfile);
  }

  public async setup(configArg: IOmbiConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(ombiProfile, new OmbiClient(configArg));
  }
}

export class HomeAssistantOmbiIntegration extends OmbiIntegration {}
