import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { PalazzettiClient } from './palazzetti.classes.client.js';
import { PalazzettiConfigFlow } from './palazzetti.classes.configflow.js';
import { createPalazzettiDiscoveryDescriptor } from './palazzetti.discovery.js';
import type { IPalazzettiConfig } from './palazzetti.types.js';
import { palazzettiDomain, palazzettiProfile } from './palazzetti.types.js';

export class PalazzettiIntegration extends SimpleLocalIntegration<IPalazzettiConfig> {
  public readonly domain = palazzettiDomain;
  public readonly discoveryDescriptor = createPalazzettiDiscoveryDescriptor();
  public readonly configFlow = new PalazzettiConfigFlow();

  constructor() {
    super(palazzettiProfile);
  }

  public override async setup(configArg: IPalazzettiConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(palazzettiProfile, new PalazzettiClient(configArg));
  }
}

export class HomeAssistantPalazzettiIntegration extends PalazzettiIntegration {}
