import uuidv4 from 'uuid/v4';

export const createTextPlaceholder = content => `<span data-placeholder="true">${content}</span>`;

export const generateImageId = () => uuidv4();

export const createSVGImageData = (options = {}) => {
    const {
        fileName,
        imageUrl,
        thumbUrl,
        operations = {},
        galleryImage = true,
        isPlaceHolderImage = false,
        svgImageSize = { width: 290, height: 290 },
    } = options;
    return {
        fileName,
        identifier: generateImageId(),
        originalFileName: imageUrl,
        original: {
            url: null,
            format: 'SVG',
            mimeType: 'image/svg+xml',
            ...svgImageSize,
        },
        preview: {
            url: imageUrl,
            format: 'SVG',
            mimeType: 'image/svg+xml',
            ...svgImageSize,
        },
        thumbnail: {
            url: thumbUrl,
            format: 'PNG',
            mimeType: 'image/png',
            width: 160,
            height: 160,
        },
        message: null,
        gallery: galleryImage,
        isPlaceHolderImage: isPlaceHolderImage,
        operations,
    };
};
