"use client";

import React from "react";
import { AutoRegisteringComponentRenderer } from "../../AutoRegisteringComponentRenderer";
import { EntitySearchInputDefinition } from "./index";
import { EntitySearchInputComponent } from "./EntitySearchInputComponent";

/**
 * EntitySearchInput 렌더러
 * 자동 등록 시스템을 사용하여 컴포넌트를 레지스트리에 등록
 */
export class EntitySearchInputRenderer extends AutoRegisteringComponentRenderer {
  static componentDefinition = EntitySearchInputDefinition;

  render(): React.ReactElement {
    return <EntitySearchInputComponent {...this.props} renderer={this} />;
  }

  /**
   * 값 변경 처리
   */
  protected handleValueChange = (value: any) => {
    this.updateComponent({ value });
  };
}

// 자동 등록 실행
EntitySearchInputRenderer.registerSelf();

// Hot Reload 지원 (개발 모드)
if (process.env.NODE_ENV === "development") {
  EntitySearchInputRenderer.enableHotReload();
}
