import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { FlicClient } from './flic.classes.client.js';
import { FlicConfigFlow } from './flic.classes.configflow.js';
import { createFlicDiscoveryDescriptor } from './flic.discovery.js';
import type { IFlicConfig } from './flic.types.js';
import { flicDomain, flicProfile } from './flic.types.js';

export class FlicIntegration extends SimpleLocalIntegration<IFlicConfig> {
  public readonly domain = flicDomain;
  public readonly discoveryDescriptor = createFlicDiscoveryDescriptor();
  public readonly configFlow = new FlicConfigFlow();

  constructor() {
    super(flicProfile);
  }

  public async setup(configArg: IFlicConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(flicProfile, new FlicClient(configArg));
  }
}

export class HomeAssistantFlicIntegration extends FlicIntegration {}
