/*
 * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3 as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import { BaseItem, DetailedItem, ItemActionsMap, ItemStateMap, LegacyItem, SandboxItem } from '../models/Item';
import { ContentType } from '../models/ContentType';
import LookupTable from '../models/LookupTable';
import ContentInstance from '../models/ContentInstance';
import { SystemType } from '../models/SystemType';
import { PublishingTargets } from '../models';
import { Dispatch } from 'react';
import { AnyAction } from 'redux';
export declare function isEditableAsset(path: string): boolean;
export declare function isAsset(path: string): boolean;
export declare function isCode(path: string): boolean;
export declare function isImage(path: string): boolean;
export declare function isItemLockedForMe(item: DetailedItem | SandboxItem | LegacyItem, username: string): boolean;
export declare function isBlobUrl(url: string): boolean;
/**
 * Returns the boolean intersection of editMode, lock status and the item's edit permission
 */
export declare function getComputedEditMode({
  item,
  username,
  editMode
}: {
  item: DetailedItem;
  username: string;
  editMode: boolean;
}): boolean;
export declare function getSystemTypeFromPath(path: string): SystemType;
export declare function parseLegacyItemToBaseItem(item: LegacyItem): BaseItem;
export declare function parseLegacyItemToSandBoxItem(item: LegacyItem): SandboxItem;
export declare function parseLegacyItemToSandBoxItem(item: LegacyItem[]): SandboxItem[];
export declare function parseLegacyItemToDetailedItem(item: LegacyItem): DetailedItem;
export declare function parseLegacyItemToDetailedItem(item: LegacyItem[]): DetailedItem[];
export declare function parseSandBoxItemToDetailedItem(item: SandboxItem): DetailedItem;
export declare function parseSandBoxItemToDetailedItem(item: SandboxItem[]): DetailedItem[];
export declare function parseSandBoxItemToDetailedItem(
  item: SandboxItem,
  detailedItemComplement: Pick<DetailedItem, 'live' | 'staging'>
): DetailedItem;
export declare function parseSandBoxItemToDetailedItem(
  item: SandboxItem[],
  detailedItemComplementByPath: LookupTable<Pick<DetailedItem, 'live' | 'staging'>>
): DetailedItem[];
export declare function parseContentXML(
  doc: XMLDocument,
  path: string,
  contentTypesLookup: LookupTable<ContentType>,
  instanceLookup: LookupTable<ContentInstance>
): ContentInstance;
export interface ModelHierarchyDescriptor {
  modelId: string;
  parentId: string;
  parentContainerFieldPath: string;
  parentContainerFieldIndex: string | number;
  children: Array<string>;
}
export type ModelHierarchyMap = LookupTable<ModelHierarchyDescriptor>;
export declare const createModelHierarchyDescriptor: (
  modelId?: ModelHierarchyDescriptor['modelId'],
  parentId?: ModelHierarchyDescriptor['parentId'],
  parentContainerFieldPath?: ModelHierarchyDescriptor['parentContainerFieldPath'],
  parentContainerFieldIndex?: ModelHierarchyDescriptor['parentContainerFieldIndex'],
  children?: ModelHierarchyDescriptor['children']
) => ModelHierarchyDescriptor;
export declare function createModelHierarchyDescriptorMap(
  normalizedModels: LookupTable<ContentInstance>,
  contentTypes: LookupTable<ContentType>
): ModelHierarchyMap;
/**
 * Returns an array with the ids of the direct descendants of a given model
 */
export declare function createChildModelIdList(
  model: ContentInstance,
  contentTypes: LookupTable<ContentType>
): string[];
/**
 * Returns a lookup table as `{ [modelId]: [childModelId1, childModelId2, ...], ... }`
 */
export declare function createChildModelLookup(
  models: LookupTable<ContentInstance>,
  contentTypes: LookupTable<ContentType>
): LookupTable<string[]>;
export declare function normalizeModelsLookup(models: LookupTable<ContentInstance>): {};
export declare function normalizeModel(model: ContentInstance): ContentInstance;
export declare function denormalizeModel(
  normalized: ContentInstance,
  modelLookup: LookupTable<ContentInstance>
): ContentInstance;
export declare function getNumOfMenuOptionsForItem(item: DetailedItem): number;
export declare const isNewState: (value: number) => boolean;
export declare const isModifiedState: (value: number) => boolean;
export declare const isDeletedState: (value: number) => boolean;
export declare const isLockedState: (value: number) => boolean;
export declare const isSystemProcessingState: (value: number) => boolean;
export declare const isSubmittedState: (value: number) => boolean;
export declare const isScheduledState: (value: number) => boolean;
export declare const isPublishingState: (value: number) => boolean;
export declare const isSubmittedToStaging: (value: number) => boolean;
export declare const isSubmittedToLive: (value: number) => boolean;
export declare const isStaged: (value: number) => boolean;
export declare const isLive: (value: number) => boolean;
export declare const isDisabled: (value: number) => boolean;
export declare const isTranslationUpToDateState: (value: number) => boolean;
export declare const isTranslationPendingState: (value: number) => boolean;
export declare const isTranslationInProgressState: (value: number) => boolean;
export declare const createItemStateMap: (status: number) => ItemStateMap;
export declare const hasReadAction: (value: number) => boolean;
export declare const hasCopyAction: (value: number) => boolean;
export declare const hasReadHistoryAction: (value: number) => boolean;
export declare const hasGetDependenciesAction: (value: number) => boolean;
export declare const hasPublishRequestAction: (value: number) => boolean;
export declare const hasCreateAction: (value: number) => boolean;
export declare const hasPasteAction: (value: number) => boolean;
export declare const hasEditAction: (value: number) => boolean;
export declare const hasRenameAction: (value: number) => boolean;
export declare const hasCutAction: (value: number) => boolean;
export declare const hasUploadAction: (value: number) => boolean;
export declare const hasDuplicateAction: (value: number) => boolean;
export declare const hasChangeTypeAction: (value: number) => boolean;
export declare const hasRevertAction: (value: number) => boolean;
export declare const hasEditControllerAction: (value: number) => boolean;
export declare const hasEditTemplateAction: (value: number) => boolean;
export declare const hasCreateFolderAction: (value: number) => boolean;
export declare const hasContentDeleteAction: (value: number) => boolean;
export declare const hasDeleteControllerAction: (value: number) => boolean;
export declare const hasDeleteTemplateAction: (value: number) => boolean;
export declare const hasPublishAction: (value: number) => boolean;
export declare const hasApprovePublishAction: (value: number) => boolean;
export declare const hasSchedulePublishAction: (value: number) => boolean;
export declare const hasPublishRejectAction: (value: number) => boolean;
export declare const hasUnlockAction: (value: number) => boolean;
export declare const createItemActionMap: (availableActions: number) => ItemActionsMap;
export declare function lookupItemByPath<T = DetailedItem>(path: string, lookupTable: LookupTable<T>): T;
export declare function modelsToLookup(models: ContentInstance[]): LookupTable<ContentInstance>;
export declare function createPathIdMap(models: LookupTable<ContentInstance>): LookupTable<string>;
export declare function getEditorMode(mimeType: string): 'ftl' | 'groovy' | 'javascript' | 'css' | 'text';
export declare function prepareVirtualItemProps(item: SandboxItem): SandboxItem;
export declare function prepareVirtualItemProps(item: DetailedItem): DetailedItem;
export declare function prepareVirtualItemProps(item: SandboxItem | DetailedItem): SandboxItem | DetailedItem;
export declare function getDateScheduled(item: DetailedItem): string;
export declare function getDatePublished(item: DetailedItem): string;
export declare function getComputedPublishingTarget(item: DetailedItem): PublishingTargets | null;
export declare function applyFolderNameRules(
  name: string,
  options?: {
    allowBraces: boolean;
  }
): string;
export declare function applyAssetNameRules(
  name: string,
  options?: {
    allowBraces: boolean;
  }
): string;
export declare const openItemEditor: (
  item: DetailedItem,
  authoringBase: string,
  siteId: string,
  dispatch: Dispatch<AnyAction>,
  onSaveSuccess?: AnyAction
) => void;
export declare function generateComponentBasePath(contentType: string): string;
export declare function generateComponentPath(modelId: string, contentType: string): string;
