import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { PicottsClient } from './picotts.classes.client.js';
import { PicottsConfigFlow } from './picotts.classes.configflow.js';
import { createPicottsDiscoveryDescriptor } from './picotts.discovery.js';
import type { IPicottsConfig } from './picotts.types.js';
import { picottsDomain, picottsProfile } from './picotts.types.js';

export class PicottsIntegration extends SimpleLocalIntegration<IPicottsConfig> {
  public readonly domain = picottsDomain;
  public readonly discoveryDescriptor = createPicottsDiscoveryDescriptor();
  public readonly configFlow = new PicottsConfigFlow();

  constructor() {
    super(picottsProfile);
  }

  public override async setup(configArg: IPicottsConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(picottsProfile, new PicottsClient(configArg));
  }
}

export class HomeAssistantPicottsIntegration extends PicottsIntegration {}
