import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { HdmiCecClient } from './hdmi_cec.classes.client.js';
import { HdmiCecConfigFlow } from './hdmi_cec.classes.configflow.js';
import { createHdmiCecDiscoveryDescriptor } from './hdmi_cec.discovery.js';
import type { IHdmiCecConfig } from './hdmi_cec.types.js';
import { hdmiCecDomain, hdmiCecProfile } from './hdmi_cec.types.js';

export class HdmiCecIntegration extends SimpleLocalIntegration<IHdmiCecConfig> {
  public readonly domain = hdmiCecDomain;
  public readonly discoveryDescriptor = createHdmiCecDiscoveryDescriptor();
  public readonly configFlow = new HdmiCecConfigFlow();

  constructor() {
    super(hdmiCecProfile);
  }

  public async setup(configArg: IHdmiCecConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(hdmiCecProfile, new HdmiCecClient(configArg));
  }
}

export class HomeAssistantHdmiCecIntegration extends HdmiCecIntegration {}
