import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { OrviboClient } from './orvibo.classes.client.js';
import { OrviboConfigFlow } from './orvibo.classes.configflow.js';
import { createOrviboDiscoveryDescriptor } from './orvibo.discovery.js';
import type { IOrviboConfig } from './orvibo.types.js';
import { orviboDomain, orviboProfile } from './orvibo.types.js';

export class OrviboIntegration extends SimpleLocalIntegration<IOrviboConfig> {
  public readonly domain = orviboDomain;
  public readonly discoveryDescriptor = createOrviboDiscoveryDescriptor();
  public readonly configFlow = new OrviboConfigFlow();

  constructor() {
    super(orviboProfile);
  }

  public async setup(configArg: IOrviboConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(orviboProfile, new OrviboClient(configArg));
  }
}

export class HomeAssistantOrviboIntegration extends OrviboIntegration {}
