import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { FilesizeClient } from './filesize.classes.client.js';
import { FilesizeConfigFlow } from './filesize.classes.configflow.js';
import { createFilesizeDiscoveryDescriptor } from './filesize.discovery.js';
import type { IFilesizeConfig } from './filesize.types.js';
import { filesizeDomain, filesizeProfile } from './filesize.types.js';

export class FilesizeIntegration extends SimpleLocalIntegration<IFilesizeConfig> {
  public readonly domain = filesizeDomain;
  public readonly discoveryDescriptor = createFilesizeDiscoveryDescriptor();
  public readonly configFlow = new FilesizeConfigFlow();

  constructor() {
    super(filesizeProfile);
  }

  public async setup(configArg: IFilesizeConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(filesizeProfile, new FilesizeClient(configArg));
  }
}

export class HomeAssistantFilesizeIntegration extends FilesizeIntegration {}
