import dynamic from 'next/dynamic';

import { techsSectionParser } from './parser';
import { defaultTechsSectionConfig } from './default-config';

import { actions } from '#/lib/command';
import { PanelsEnum, Sections } from '#/types';

const feature = {
  id: Sections.TECHS,

  presentation: {
    [PanelsEnum.NEW_SECTION]: {
      icon: 'cpu',
      onClick: () => actions.canvas.section.add(Sections.TECHS),
      name: 'Techs',
    },

    sections: {
      component: dynamic(() =>
        import('./section').then(
          mod => mod.TechsSection,
          () => () => null
        )
      ),
      parser: {
        readme: techsSectionParser,
      },
      defaultConfig: defaultTechsSectionConfig,
    },

    panels: dynamic(() =>
      import('./panel').then(
        mod => mod.TechsEditPanel,
        () => () => null
      )
    ),
  },
};

actions.extensions.register(feature);
