import { createTypedValidator } from '@takeshape/json-schema';
import { ASSET_IMAGE_META_SHAPE_NAME, ASSET_IMAGE_PARAMS_SHAPE_NAME, ASSET_IMAGE_SHAPE_NAME, ASSET_SHAPE_ID, ASSET_SHAPE_NAME } from "./constants.js";
export const shapeName = ASSET_SHAPE_NAME;
export const shapeId = ASSET_SHAPE_ID;
export const schema = {
    type: 'object',
    properties: {
        title: {
            type: 'string',
            title: 'Title',
            '@mapping': 'shapedb:Asset.By5tQOMc',
            '@l10n': true
        },
        description: {
            type: 'string',
            title: 'Description',
            '@mapping': 'shapedb:Asset.B1Zsra3fx',
            '@l10n': true
        },
        filename: {
            type: 'string',
            title: 'Filename',
            '@l10n': false,
            minLength: 1,
            '@mapping': 'shapedb:Asset.H1oYQOM9'
        },
        caption: {
            type: 'object',
            title: 'Caption',
            '@mapping': 'shapedb:Asset.SyWVsd98x',
            '@tag': 'draftjs',
            '@l10n': true
        },
        credit: {
            type: 'object',
            title: 'Credit',
            '@mapping': 'shapedb:Asset.Skn_i_5Ll',
            '@tag': 'draftjs',
            '@l10n': true
        },
        path: {
            type: 'string',
            title: 'Path',
            '@l10n': false,
            minLength: 1,
            '@mapping': 'shapedb:Asset.Hk6FQuz5'
        },
        mimeType: {
            type: 'string',
            title: 'MIME type',
            '@l10n': false,
            '@mapping': 'shapedb:Asset.SyCYX_Gq'
        },
        sourceUrl: {
            type: 'string',
            title: 'Source URL',
            '@l10n': false,
            '@mapping': 'shapedb:Asset.SJXSidnXE'
        },
        uploadStatus: {
            type: 'string',
            title: 'Upload status',
            '@l10n': false,
            '@mapping': 'shapedb:Asset.ByeAYXdG9'
        },
        url: {
            type: 'string',
            title: 'URL',
            '@l10n': false,
            '@dependencies': '{path mimeType uploadStatus filename _id}',
            '@resolver': {
                name: 'takeshape:assetUrl',
                service: 'takeshape'
            }
        },
        image: {
            title: 'Image',
            '@l10n': false,
            '@dependencies': '{path mimeType uploadStatus filename _id}',
            '@resolver': {
                name: 'takeshape:assetImage',
                service: 'takeshape'
            },
            '@args': {
                type: 'object',
                properties: {
                    params: {
                        '@ref': ASSET_IMAGE_PARAMS_SHAPE_NAME
                    }
                }
            },
            '@ref': ASSET_IMAGE_SHAPE_NAME
        },
        imageMeta: {
            title: 'Image metadata',
            '@l10n': false,
            '@dependencies': '{path mimeType uploadStatus filename _id}',
            '@resolver': {
                name: 'takeshape:assetImageMeta',
                service: 'takeshape'
            },
            '@ref': ASSET_IMAGE_META_SHAPE_NAME
        }
    },
    required: ['filename', 'path', 'url']
};
export const validate = createTypedValidator(schema);
