import {ObjectTypeDefinition} from '../../integration/extension.provider';
import {DISPLAYED_IMAGE_GALLERY_TYPE} from '../content-image/content-image.const';
import {MAP_TYPE} from '../map/map.const';

export const IMAGES_MAP_PROVIDER = 'ImagesMapProvider';

export const IMAGES_EVENTS_MAP_TYPE: ObjectTypeDefinition = {
  name: 'ImagesAndEventsMap',
  inheritedTypesIds: [MAP_TYPE.name, DISPLAYED_IMAGE_GALLERY_TYPE.name],

  definition: {
    properties: {
      eventsLayerName: {
        type: 'string',
        title: 'events layer label',
        'x-schema-form': {
          type: 'conditional-text',
          conditionalValue: {
            title: 'Display events on map',
            defaultValue: `return 'Events'`,
          },
        },
      },
      imagesLayerName: {
        type: 'string',
        title: 'images layer label',
        'x-schema-form': {
          type: 'conditional-text',
          conditionalValue: {
            title: 'Display images on map',
            defaultValue: `return 'Images'`,
          },
        },
      },
      selectedGalleriesObjectTreeIds: {
        'x-schema-form': {
          condition: {functionBody: 'return !!model.imagesLayerName'},
        },
      },
    },
  },
};
