import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { PaperlessNgxClient } from './paperless_ngx.classes.client.js';
import { PaperlessNgxConfigFlow } from './paperless_ngx.classes.configflow.js';
import { createPaperlessNgxDiscoveryDescriptor } from './paperless_ngx.discovery.js';
import type { IPaperlessNgxConfig } from './paperless_ngx.types.js';
import { paperlessNgxDomain, paperlessNgxProfile } from './paperless_ngx.types.js';

export class PaperlessNgxIntegration extends SimpleLocalIntegration<IPaperlessNgxConfig> {
  public readonly domain = paperlessNgxDomain;
  public readonly discoveryDescriptor = createPaperlessNgxDiscoveryDescriptor();
  public readonly configFlow = new PaperlessNgxConfigFlow();

  constructor() {
    super(paperlessNgxProfile);
  }

  public async setup(configArg: IPaperlessNgxConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(paperlessNgxProfile, new PaperlessNgxClient(configArg));
  }
}

export class HomeAssistantPaperlessNgxIntegration extends PaperlessNgxIntegration {}
