import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { OnkyoClient } from './onkyo.classes.client.js';
import { OnkyoConfigFlow } from './onkyo.classes.configflow.js';
import { createOnkyoDiscoveryDescriptor } from './onkyo.discovery.js';
import type { IOnkyoConfig } from './onkyo.types.js';
import { onkyoDomain, onkyoProfile } from './onkyo.types.js';

export class OnkyoIntegration extends SimpleLocalIntegration<IOnkyoConfig> {
  public readonly domain = onkyoDomain;
  public readonly discoveryDescriptor = createOnkyoDiscoveryDescriptor();
  public readonly configFlow = new OnkyoConfigFlow();

  constructor() {
    super(onkyoProfile);
  }

  public async setup(configArg: IOnkyoConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(onkyoProfile, new OnkyoClient(configArg));
  }
}

export class HomeAssistantOnkyoIntegration extends OnkyoIntegration {}
