import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { HikvisioncamClient } from './hikvisioncam.classes.client.js';
import { HikvisioncamConfigFlow } from './hikvisioncam.classes.configflow.js';
import { createHikvisioncamDiscoveryDescriptor } from './hikvisioncam.discovery.js';
import type { IHikvisioncamConfig } from './hikvisioncam.types.js';
import { hikvisioncamDomain, hikvisioncamProfile } from './hikvisioncam.types.js';

export class HikvisioncamIntegration extends SimpleLocalIntegration<IHikvisioncamConfig> {
  public readonly domain = hikvisioncamDomain;
  public readonly discoveryDescriptor = createHikvisioncamDiscoveryDescriptor();
  public readonly configFlow = new HikvisioncamConfigFlow();

  constructor() {
    super(hikvisioncamProfile);
  }

  public async setup(configArg: IHikvisioncamConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(hikvisioncamProfile, new HikvisioncamClient(configArg));
  }
}

export class HomeAssistantHikvisioncamIntegration extends HikvisioncamIntegration {}
