import type { Component } from 'vue';

class FieldRegistry {
  private static readonly _instance: FieldRegistry = new FieldRegistry();
  private readonly _map: Map<string, Component>;
  constructor() {
    this._map = new Map<string, Component>();
  }

  push(compName: string, component: Component) {
    this._map.set(compName, component);
  }

  static get instance() {
    return this._instance;
  }

  get(compName: string) {
    return this._map.get(compName);
  }

  get map() {
    return this._map;
  }
}
const fieldRegistry = FieldRegistry.instance;
export { fieldRegistry };
