import { createTypedValidator } from '@takeshape/json-schema';
import { ASSET_IMAGE_META_SHAPE_ID, ASSET_IMAGE_META_SHAPE_NAME } from "./constants.js";
export const shapeName = ASSET_IMAGE_META_SHAPE_NAME;
export const shapeId = ASSET_IMAGE_META_SHAPE_ID;
// Example imgix metadata
// {
//   Orientation: 0,
//   TransparentPercentage: 0,
//   Output: {},
//   DPIWidth: 96,
//   'Content-Length': '244871',
//   'Content-Type': 'image/jpeg',
//   PixelHeight: 1024,
//   PixelWidth: 1024,
//   ProfileName: 'sRGB IEC61966-2.1',
//   DPIHeight: 96
// }
//
// {
//   Exif: { PixelXDimension: 640, PixelYDimension: 640, ColorSpace: 1 },
//   Orientation: 1,
//   'Content-Type': 'image/png',
//   TransparentPercentage: 0,
//   Output: {},
//   DPIWidth: 72,
//   'Content-Length': '687902',
//   PixelWidth: 640,
//   TIFF: {
//     ResolutionUnit: 2,
//     Orientation: 1,
//     XResolution: 72,
//     ExifTag: 90,
//     YResolution: 72
//   },
//   GPS: {},
//   PixelHeight: 640,
//   XMP: { Orientation: '1' },
//   DPIHeight: 72,
//   ProfileName: 'sRGB IEC61966-2.1'
// }
export const imgixImageMeta = {
    type: 'object',
    properties: {
        PixelWidth: {
            type: 'integer'
        },
        PixelHeight: {
            type: 'integer'
        },
        DPIWidth: {
            type: 'integer'
        },
        DPIHeight: {
            type: 'integer'
        },
        ProfileName: {
            type: 'string'
        },
        'Content-Type': {
            type: 'string'
        },
        'Content-Length': {
            type: 'string'
        }
    },
    required: ['PixelHeight', 'PixelWidth', 'Content-Type', 'Content-Length']
};
export const validateImgixImageMeta = createTypedValidator(imgixImageMeta);
export const schema = {
    type: 'object',
    properties: {
        pixelHeight: {
            type: 'integer'
        },
        pixelWidth: {
            type: 'integer'
        },
        dpiHeight: {
            type: 'integer'
        },
        dpiWidth: {
            type: 'integer'
        },
        profileName: {
            type: 'string'
        },
        contentType: {
            type: 'string'
        },
        contentLength: {
            type: 'string'
        }
    },
    // These should be available on every image
    required: ['pixelHeight', 'pixelWidth', 'contentType', 'contentLength'],
    additionalProperties: false
};
export const validate = createTypedValidator(schema);
