import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MotionmountClient } from './motionmount.classes.client.js';
import { MotionmountConfigFlow } from './motionmount.classes.configflow.js';
import { createMotionmountDiscoveryDescriptor } from './motionmount.discovery.js';
import type { IMotionmountConfig } from './motionmount.types.js';
import { motionmountDomain, motionmountProfile } from './motionmount.types.js';

export class MotionmountIntegration extends SimpleLocalIntegration<IMotionmountConfig> {
  public readonly domain = motionmountDomain;
  public readonly discoveryDescriptor = createMotionmountDiscoveryDescriptor();
  public readonly configFlow = new MotionmountConfigFlow();

  constructor() {
    super(motionmountProfile);
  }

  public override async setup(configArg: IMotionmountConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(motionmountProfile, new MotionmountClient(configArg));
  }
}

export class HomeAssistantMotionmountIntegration extends MotionmountIntegration {}
