import {
  ObjectSubTypeDefinition,
  ObjectTypeDefinition,
} from '../../integration/extension.provider';
export const CONTENT_FILE_PROVIDER = 'ContentFileProvider';
export const CONTENT_FILE_SERVICE = 'ContentFileService';

export const FILE_DIRECTORIES_TYPE: ObjectTypeDefinition = {
  name: 'FileGalleries',
  title: 'File directories',
  definition: {
    properties: {},
  },
  contentType: '',
  iconView: 'fas fa-photo-video',
};

export const FILES_DIRECTORY_TYPE: ObjectTypeDefinition = {
  name: 'FilesDirectory',
  inheritedTypesIds: [],
  title: 'Files',
  definition: {
    properties: {},
  },
  contentType: '',
  iconView: 'far fa-files',
};

export const FILE_DIRECTORY_REFERRER_TYPE: ObjectTypeDefinition = {
  name: 'FileDirectoryReferrer',
  title: 'Files referrer',
  inheritedTypesIds: [],
  definition: {
    properties: {
      fileDirectoryObjectTreeId: {
        title: 'File directory',
        type: 'string',
        oneOfTree: [
          {
            treeType: FILES_DIRECTORY_TYPE.name,
          },
        ],
      },
    },
  },
  contentType: '',
};

export const FILE_DIRECTORY_SELECTOR_TYPE: ObjectTypeDefinition = {
  name: 'FileDirectorySelector',
  inheritedTypesIds: [FILE_DIRECTORY_REFERRER_TYPE.name],
  definition: {
    properties: {
      selectedFiles: {
        title: 'Selected files',
        type: 'array',
        items: {
          type: 'string',
        },
        'x-schema-form': {
          condition: 'undefined !== embeddedCondition',
        },
      },
    },
  },
  contentType: '',
};

export const FILE_TYPE: ObjectTypeDefinition = {
  name: 'File',
  definition: {
    properties: {},
  },
  contentType: 'ContentFile',
  iconView: 'far fa-file',
};

export const FILE_DIRECTORIES_FILES_DIRECTORY_SUBTYPE: ObjectSubTypeDefinition = {
  typeName: FILE_DIRECTORIES_TYPE.name,
  subTypeName: FILES_DIRECTORY_TYPE.name,
  name: FILES_DIRECTORY_TYPE.name,
  acl: false,
  namespace: false,
  owner: false,
  tree: true,
};

export const FILES_DIRECTORY_FILES_DIRECTORY_SUBTYPE: ObjectSubTypeDefinition = {
  typeName: FILES_DIRECTORY_TYPE.name,
  subTypeName: FILES_DIRECTORY_TYPE.name,
  name: FILES_DIRECTORY_TYPE.name,
  acl: false,
  namespace: false,
  owner: false,
  tree: true,
};

export const FILE_DIRECTORY_FILE_SUBTYPE: ObjectSubTypeDefinition = {
  typeName: FILES_DIRECTORY_TYPE.name,
  subTypeName: FILE_TYPE.name,
  name: FILE_TYPE.name,
  acl: false,
  namespace: false,
  owner: false,
  tree: false,
};
