import {
  contentGenericTemplate,
  ContentImageProvider,
  ObjectTreesApplicationInterface,
} from '../..';
import {ExtensionProvider} from '../../integration/extension.provider';
import {IMAGE_GALLERY_TEMPLATE_TYPE} from '../content-image-template/content-image-template.const';
import {MAP_TEMPLATE_TYPE} from '../map/map.const';
import {MapProvider} from '../map/map.provider';
import {IMAGES_EVENTS_MAP_TYPE} from './images-map.const';

export class ImagesMapProvider extends ExtensionProvider {
  constructor(protected app: ObjectTreesApplicationInterface) {
    super(ImagesMapProvider.name, app);

    this.requiredProviders.push(MapProvider, ContentImageProvider);

    this.services.push();

    this.objectTypes.push(IMAGES_EVENTS_MAP_TYPE);

    this.objectSubTypes.push();

    this.objectTrees.imagesMap = {
      reset: false,
      parentNode: () => this.appCtx.publicTemplatesNode.value,
      treeNodeName: 'imagesMap',
      treeNodeTypeId: IMAGE_GALLERY_TEMPLATE_TYPE.name,
      tree: {
        treeNode: {
          contentGenericTemplate: contentGenericTemplate(
            __dirname,
            'imagesMap',
          ),
        },
        children: {},
      },
    };

    this.objectTrees.imagesAndEventsMap = {
      reset: false,
      parentNode: () => this.appCtx.publicTemplatesNode.value,
      treeNodeName: 'imagesAndEventsMap',
      treeNodeTypeId: MAP_TEMPLATE_TYPE.name,
      tree: {
        treeNode: {
          contentGenericTemplate: contentGenericTemplate(
            __dirname,
            'imagesAndEventsMap',
          ),
        },
        children: {},
      },
    };
  }
}
