import { createTypedValidator } from '@takeshape/json-schema';
import { ASSET_IMAGE_PARAMS_SHAPE_ID, ASSET_IMAGE_PARAMS_SHAPE_NAME } from "./constants.js";
export const shapeName = ASSET_IMAGE_PARAMS_SHAPE_NAME;
export const shapeId = ASSET_IMAGE_PARAMS_SHAPE_ID;
// Imgix Rendering API parameters schema
// Reference: https://docs.imgix.com/apis/rendering
export const schema = {
    type: 'object',
    properties: {
        // Adjustment
        bri: { type: 'integer', description: 'Brightness' },
        con: { type: 'integer', description: 'Contrast' },
        exp: { type: 'integer', description: 'Exposure' },
        gam: { type: 'number', description: 'Gamma' },
        high: { type: 'integer', description: 'Highlights' },
        hue: { type: 'integer', description: 'Hue' },
        invert: { type: 'boolean', description: 'Invert' },
        sat: { type: 'integer', description: 'Saturation' },
        shad: { type: 'integer', description: 'Shadows' },
        vib: { type: 'integer', description: 'Vibrance' },
        sharp: { type: 'integer', description: 'Sharpen' },
        usmrad: { type: 'integer', description: 'Unsharp Mask Radius' },
        usm: { type: 'integer', description: 'Unsharp Mask' },
        // Animation
        gifQ: { type: 'integer', description: 'Animated GIF Quality' },
        loop: { type: 'integer', description: 'Animated Loop Count' },
        interval: { type: 'integer', description: 'Frame Interval' },
        frame: { type: 'string', description: 'Frame Selection' },
        // Blending
        blend: { type: 'string', title: 'Blend image URL' },
        blendMode: {
            enum: [
                'color',
                'burn',
                'dodge',
                'darken',
                'difference',
                'exclusion',
                'hardlight',
                'hue',
                'lighten',
                'luminosity',
                'multiply',
                'overlay',
                'saturation',
                'screen',
                'softlight'
            ],
            title: 'Blend mode'
        },
        blendAlign: {
            type: 'string',
            title: 'Blend alignment'
        },
        blendAlpha: { type: 'integer', title: 'Blend alpha' },
        blendW: { type: 'integer', title: 'Blend width' },
        blendH: { type: 'integer', title: 'Blend height' },
        blendX: { type: 'integer', title: 'Blend x offset' },
        blendY: { type: 'integer', title: 'Blend y offset' },
        blendCrop: {
            enum: ['top', 'bottom', 'left', 'right', 'faces', 'entropy', 'edges', 'focalpoint'],
            title: 'Blend crop'
        },
        blendFit: {
            enum: ['clip', 'crop', 'scale'],
            title: 'Blend fit'
        },
        blendPad: {
            type: 'integer',
            title: 'Blend padding'
        },
        blendSize: {
            enum: ['inherit'],
            title: 'Blend size'
        },
        blendTile: {
            enum: ['grid'],
            title: 'Blend tile'
        },
        blendRot: {
            type: 'integer',
            title: 'Blend rotation'
        },
        // Border & Padding
        border: {
            type: 'string',
            title: 'Border',
            description: 'Draws a border around the image.  The border overlaps the image rather than altering its size.  The width and color must be specified as a comma-separated list.  To round corners, use border-radius and border-radius-inner in addition to border.'
        },
        borderBottom: {
            type: 'integer',
            title: 'Border Bottom',
            description: 'Sets the border size on the bottom side of the image.'
        },
        borderLeft: {
            type: 'integer',
            title: 'Border Left',
            description: 'Sets the border size on the left side of the image.'
        },
        borderRight: {
            type: 'integer',
            title: 'Border Right',
            description: 'Sets the border size on the right side of the image.'
        },
        borderTop: {
            type: 'integer',
            title: 'Border Top',
            description: 'Sets the border size on the top side of the image.'
        },
        borderRadius: {
            type: 'integer',
            title: 'Border Radius',
            description: 'Sets the outer radius of the border, applying to all corners of the image.'
        },
        borderRadiusBottomLeft: {
            type: 'integer',
            title: 'Border Radius Bottom Left',
            description: 'Sets the outer radius of the bottom-left border, in pixels.'
        },
        borderRadiusBottomRight: {
            type: 'integer',
            title: 'Border Radius Bottom Right',
            description: 'Sets the outer radius of the bottom-right border, in pixels.'
        },
        borderRadiusInner: {
            type: 'integer',
            title: 'Border Radius Inner',
            description: 'Sets the inner radius of the border, applying to all corners.'
        },
        borderRadiusInnerBottomLeft: {
            type: 'integer',
            title: 'Border Radius Inner Bottom Left',
            description: 'Sets the inner radius of the bottom-left border, in pixels.'
        },
        borderRadiusInnerBottomRight: {
            type: 'integer',
            title: 'Border Radius Inner Bottom Right',
            description: 'Sets the inner radius of the bottom-right border, in pixels.'
        },
        borderRadiusInnerTopLeft: {
            type: 'integer',
            title: 'Border Radius Inner Top Left',
            description: 'Sets the inner radius of the top-left border, in pixels.'
        },
        borderRadiusInnerTopRight: {
            type: 'integer',
            title: 'Border Radius Inner Top Right',
            description: 'Sets the inner radius of the top-right border, in pixels.'
        },
        borderRadiusTopLeft: {
            type: 'integer',
            title: 'Border Radius Top Left',
            description: 'Sets the outer radius of the top-left border, in pixels.'
        },
        borderRadiusTopRight: {
            type: 'integer',
            title: 'Border Radius Top Right',
            description: 'Sets the outer radius of the top-right border, in pixels.'
        },
        pad: {
            type: 'integer',
            title: 'Padding',
            description: 'Pads the image by the number of pixels specified.  Must be a positive integer.'
        },
        padBottom: {
            type: 'integer',
            title: 'Padding Bottom',
            description: 'Sets the padding on the bottom side of the image.'
        },
        padLeft: {
            type: 'integer',
            title: 'Padding Left',
            description: 'Sets the padding on the left side of the image.'
        },
        padRight: {
            type: 'integer',
            title: 'Padding Right',
            description: 'Sets the padding on the right side of the image.'
        },
        padTop: {
            type: 'integer',
            title: 'Padding Top',
            description: 'Sets the padding on the top side of the image.'
        },
        bg: {
            type: 'string',
            title: 'Background Color',
            description: 'Sets the background color for the padded area.  When outputting image formats that do not support transparency (such as JPEG), set this value to a non-transparent color.'
        },
        // Color Palette
        palette: {
            enum: ['css', 'json'],
            title: 'Color Palette Extraction',
            description: 'Extracts a palette of color values from an image and returns them in the specified format.'
        },
        colors: {
            type: 'integer',
            title: 'Palette Color Count',
            description: 'Determines the size of the default palette returned by the palette parameter.'
        },
        prefix: {
            type: 'string',
            title: 'CSS Prefix',
            description: 'Sets the prefix for the CSS classes when palette=css.  Ignored if palette=json.'
        },
        // Device Pixel Ratio
        dpr: {
            type: 'number',
            title: 'Device Pixel Ratio',
            description: 'Controls the output density of your image, so you can serve images at the correct density for every user’s device from a single image.'
        },
        // Expiration Timestamp
        expires: {
            type: 'integer',
            title: 'Expiration Timestamp',
            description: 'The expires parameter accepts a UNIX timestamp (expressed in absolute seconds) such as ?expires=1477789261, which translates to 10/30/2016 01:01:01 AM UTC. This value specifies an expiration date after which the image URL should no longer be served.'
        },
        // Face Detection
        faceindex: {
            type: 'integer',
            title: 'Face Index',
            description: 'Selects a face on which to center an image when fit=facearea.'
        },
        facepad: {
            type: 'number',
            title: 'Face Padding',
            description: 'Defines how much padding to allow for each face when fit=facearea.  The value defines the padding ratio based on the pixel dimensions of the face.'
        },
        faceBlur: {
            type: 'number',
            title: 'Face Blur',
            description: 'Blurs the detected faces in the image.'
        },
        facePixel: {
            type: 'number',
            title: 'Face Pixelate',
            description: 'Pixelates the detected faces in the image.'
        },
        faces: {
            type: 'integer',
            title: 'Faces',
            description: 'Returns the number of faces detected. Should be used with fm=json.'
        },
        // Fill
        fill: {
            enum: ['blur', 'gen', 'gradient', 'solid'],
            description: 'Determines how the excess space in an image resized with fit=fill or fit=fillmax should be filled.'
        },
        fillColor: {
            type: 'string',
            description: "Specifies the solid color applied to the excess space when fill=solid. Accepts color keywords or 3, 4, 6, or 8-digit hexadecimal values (RGB, ARGB, RRGGBB, AARRGGBB). The 'A' in 4 or 8-digit hex represents alpha transparency. Default is transparent white (0FFF)."
        },
        fillGenFallback: {
            type: 'boolean',
            description: "Controls fallback behavior for generative fill (fill=gen). A value of 'true' means Imgix serves the original image if generative fill fails. A value of 'false' returns a 400 error. Defaults to 'true' when not specified."
        },
        fillGenNegPrompt: {
            type: 'string',
            description: 'Negative text input suggestion for generative fill. (Premium Feature)'
        },
        fillGenPos: {
            type: 'string',
            description: "Controls where the original image is positioned when using fit=fill&fill=gen. Accepts horizontal (left, middle, right) and vertical (top, center, bottom) options, comma-separated. Default is 'middle,center'. (Premium Feature)"
        },
        fillGenPrompt: {
            type: 'string',
            description: 'Text input suggestion for generative fill. (Premium Feature)'
        },
        fillGenSeed: {
            type: 'integer',
            description: 'Used to generate more predictable outputs for generative fill.'
        },
        fillGradientCs: {
            type: 'string',
            description: "Sets the color space for the fill gradient. Values typically include 'srgb', 'rgb', 'cmyk', 'p3', 'adobergb', 'prophoto', 'displayp3'."
        },
        fillGradientLinearDirection: {
            type: 'string',
            description: "Sets the linear gradient color direction when fill-gradient-type=linear is used. Accepted values are 'top', 'bottom', 'right', and 'left'. Can be two comma-separated values. Defaults to 'bottom' when not specified."
        },
        fillGradientLinear: {
            type: 'string',
            description: "Sets the linear gradient color when fill-gradient-type=linear is used. Accepts two comma-separated values expressed as either color keywords or 3- (RGB) or 6-digit (RRGGBB) hexadecimal color values. Defaults to image's color palette (vibrant dark for color1, vibrant light for color2) if not specified."
        },
        fillGradientRadial: {
            type: 'string',
            description: "Sets the radial gradient color when fill-gradient-type=radial is used. Accepts two comma-separated values expressed as either color keywords or 3- (RGB) or 6-digit (RRGGBB) hexadecimal color values. Defaults to image's color palette (vibrant dark for color1, vibrant light for color2) if not specified."
        },
        fillGradientRadialRadius: {
            type: 'number',
            description: "Sets the radius of the radial gradient when fill-gradient-type=radial is used. Can be expressed as a percentage (e.g., '50%') or pixels (e.g., '100')."
        },
        fillGradientRadialX: {
            type: 'number',
            description: "Sets the X-coordinate of the radial gradient's center when fill-gradient-type=radial is used. Can be expressed as a percentage or pixels."
        },
        fillGradientRadialY: {
            type: 'number',
            description: "Sets the Y-coordinate of the radial gradient's center when fill-gradient-type=radial is used. Can be expressed as a percentage or pixels."
        },
        fillGradientType: {
            enum: ['linear', 'radial'],
            description: "Sets the type of gradient used when fill=gradient. Accepted values are 'linear' and 'radial'."
        },
        gridColors: {
            type: 'string',
            description: 'Specifies the colors for the grid pattern when fill=grid. Accepts two comma-separated color values (keywords or hex codes).'
        },
        gridSize: {
            type: 'number',
            description: 'Specifies the size of the grid cells in pixels when fill=grid.'
        },
        transparency: {
            type: 'string',
            description: "Controls the transparency of the fill. Can be a number (0-100) or 'alpha'. If 'alpha', it will use the alpha channel of the image. When outputting image formats that do not support transparency, set this value to a non-transparent color."
        },
        // Focal Point Crop
        fpDebug: {
            type: 'boolean',
            title: 'Focal Point Debug',
            description: 'Focal Point Debug'
        },
        fpX: {
            type: 'number',
            title: 'Focal Point X Position',
            description: 'Focal Point X Position'
        },
        fpY: {
            type: 'number',
            title: 'Focal Point Y Position',
            description: 'Focal Point Y Position'
        },
        fpZ: {
            type: 'number',
            title: 'Focal Point Zoom',
            description: 'Focal Point Zoom'
        },
        // Format
        fm: {
            type: 'string',
            enum: [
                'avif',
                'gif',
                'jp2',
                'jpg',
                'json',
                'jxr',
                'pjpg',
                'mp4',
                'png',
                'png8',
                'png32',
                'webm',
                'webp',
                'blurhash'
            ],
            description: 'Output Format'
        },
        q: {
            type: 'integer',
            description: 'Quality'
        },
        chromasub: {
            enum: ['420', '422', '444'],
            description: 'Chroma Subsampling'
        },
        lossless: {
            type: 'boolean',
            description: 'Lossless compression'
        },
        cs: {
            enum: ['origin', 'srgb', 'adobergb1998', 'tinysrgb', 'strip'],
            description: 'Color space'
        },
        ch: {
            type: 'string',
            description: 'Client Hints'
        },
        dpi: {
            type: 'integer',
            description: 'Dots Per Inch'
        },
        dl: {
            type: 'boolean',
            description: 'Download'
        },
        iptc: {
            enum: ['allow', 'block'],
            description: 'IPTC Passthrough'
        },
        jpegProgressive: {
            type: 'boolean',
            description: 'JPG Progressive'
        },
        rasterizeBypass: {
            type: 'boolean',
            description: 'Rasterize Bypass'
        },
        svgSanitize: {
            type: 'boolean',
            description: 'Sanitize SVG'
        },
        // License Plate Detection
        lpBlur: {
            type: 'integer',
            title: 'License Plate Blur',
            description: 'Automatically detects and blurs license plates in an image. The value determines the intensity of the blur.'
        },
        // Mask Image
        mask: {
            type: 'string',
            title: 'Mask',
            description: 'Sets the type of mask from a pre-defined list of shapes, or from a transparent image URL.'
        },
        // Noise Reduction
        nr: {
            type: 'integer',
            title: 'Noise Reduction Bound',
            description: 'Sets the threshold for noise reduction.'
        },
        nrs: {
            type: 'integer',
            title: 'Noise Reduction Sharpen',
            description: 'Determines the amount of sharpening in pixels above the bound set by nr, reducing noise in the image.'
        },
        // Rotation
        flip: {
            enum: ['h', 'v', 'hv'],
            title: 'Flip Axis',
            description: 'Flips the image along its axes.'
        },
        orient: {
            type: 'integer',
            title: 'Orientation',
            description: 'Changes the cardinal orientation of the image by overriding any Exif orientation metadata.'
        },
        rot: {
            type: 'integer',
            title: 'Rotation',
            description: 'Rotates the image by degrees according to the value specified.'
        },
        rotType: {
            enum: ['pivot', 'straighten'],
            title: 'Rotation Type',
            description: 'Controls the type of rotation applied when rot is set.'
        },
        // Size
        w: {
            type: 'number',
            title: 'Width',
            description: 'The width of the output image.'
        },
        h: {
            type: 'number',
            title: 'Height',
            description: 'The height of the output image.'
        },
        ar: {
            type: 'number',
            title: 'Aspect Ratio',
            description: 'Resizes and crops the original image to match a specified aspect ratio.'
        },
        fit: {
            enum: ['clamp', 'clip', 'crop', 'facearea', 'fill', 'fillmax', 'max', 'min', 'scale'],
            title: 'Fit Mode',
            description: 'Controls how the output image is fit to its target dimensions.'
        },
        crop: {
            type: 'string',
            title: 'Crop Mode',
            description: 'Controls how the image is aligned when fit=crop is set.'
        },
        maxW: {
            type: 'integer',
            title: 'Maximum Width',
            description: 'The maximum allowed width of the output image.  Only works with fit=crop.'
        },
        maxH: {
            type: 'integer',
            title: 'Maximum Height',
            description: 'The maximum allowed height of the output image. Only works with fit=crop.'
        },
        minW: {
            type: 'integer',
            title: 'Minimum Width',
            description: 'The minimum allowed width of the output image. Only works with fit=crop.'
        },
        minH: {
            type: 'integer',
            title: 'Minimum Height',
            description: 'The minimum allowed height of the output image. Only works with fit=crop.'
        },
        rect: {
            type: 'string',
            title: 'Rectangle',
            description: 'Specifies the dimensions of the rectangle to crop the image to'
        },
        // Stylize
        blur: {
            type: 'integer',
            title: 'Blur',
            description: 'Applies a Gaussian style blur to your image, smoothing out image noise.'
        },
        duotone: {
            type: 'string',
            title: 'Duotone',
            description: 'Applies a duotone effect—a gradient with two different colors as its endpoints—to the image.'
        },
        duotoneAlpha: {
            type: 'number',
            title: 'Duotone Alpha',
            description: 'Sets the level of transparency for a duotone effect.'
        },
        htn: {
            type: 'integer',
            title: 'Halftone',
            description: 'Applies a half-toning effect to the image.'
        },
        dtfHalftone: {
            type: 'boolean',
            title: 'DTF Halftone',
            description: 'Applies a halftone effect to images being prepared for printing with the Direct to Film process.'
        },
        dtfHalftoneAngle: {
            type: 'integer',
            title: 'DTF Halftone Angle',
            description: 'Sets the angle of the halftone dots for images being prepared for printing with the Direct to Film process.'
        },
        monochrome: {
            type: 'string',
            title: 'Monochrome',
            description: 'Applies an overall monochromatic hue change.'
        },
        px: {
            type: 'integer',
            title: 'Pixelate',
            description: 'Applies a square pixellation effect to the image.'
        },
        sepia: {
            type: 'integer',
            title: 'Sepia',
            description: 'Applies a sepia-toning effect to the image.'
        },
        // Text
        txt: {
            type: 'string',
            title: 'Text String',
            description: 'The text string to overlay on the image.  For multi-line text, please see our ~text documentation instead.'
        },
        txtAlign: {
            type: 'string',
            title: 'Text Align',
            description: 'Sets the horizontal and vertical alignment of the text.'
        },
        txtClip: {
            enum: ['start', 'end', 'middle', 'ellipsis', 'startellipsis', 'endellipsis', 'middleellipsis'],
            title: 'Text Clip Mode',
            description: 'Sets the region of the string that will be clipped if the string extends beyond the defined width of the text.'
        },
        txtColor: {
            type: 'string',
            title: 'Text Color',
            description: 'Sets the color of the text.'
        },
        txtFit: {
            enum: ['max'],
            title: 'Text Fit Mode',
            description: 'Controls how the text is fit to its container.'
        },
        txtFont: {
            type: 'string',
            title: 'Text Font',
            description: 'Defines the typeface and style to set the text in.  The value may be either a CSS-style category, or an explicit font name.'
        },
        txtLine: {
            type: 'integer',
            title: 'Text Line',
            description: 'Sets the line height of the text, as a multiplier of the font size.'
        },
        txtLineColor: {
            type: 'string',
            title: 'Text Line Color',
            description: 'Sets the color of the line when txt-line is greater than 0.'
        },
        txtPad: {
            type: 'integer',
            title: 'Text Padding',
            description: 'The amount of spacing (in pixels) to add around the text.'
        },
        txtShad: {
            type: 'integer',
            title: 'Text Shadow',
            description: 'A number indicating the strength of a shadow to place on the text.'
        },
        txtSize: {
            type: 'integer',
            title: 'Text Size',
            description: 'Sets the font size of the text, in pixels.'
        },
        txtWidth: {
            type: 'integer',
            title: 'Text Width',
            description: 'The width (in pixels) to restrict the width of the text to.'
        },
        txtX: {
            type: 'integer',
            title: 'Text X Position',
            description: 'The horizontal offset of the text from its alignment position'
        },
        txtY: {
            type: 'integer',
            title: 'Text Y Position',
            description: 'The vertical offset of the text from its alignment position'
        },
        // Trim
        trim: {
            enum: ['auto', 'color', 'alpha', 'colorunlesalpha'],
            title: 'Trim',
            description: 'Trims the image to remove a uniform border around the image.'
        },
        trimAlpha: {
            type: 'number',
            title: 'Trim Alpha',
            description: 'Defines the alpha transparency threshold for trimming.'
        },
        trimColor: {
            type: 'string',
            title: 'Trim Color',
            description: 'Defines which color to trim when trim=color is used.'
        },
        trimMd: {
            type: 'integer',
            title: 'Trim Mean Difference',
            description: 'The mean difference threshold for the trimming operation when trim=auto.'
        },
        trimPad: {
            type: 'integer',
            title: 'Trim Padding',
            description: 'Adds padding, in pixels, to the trimmed image.'
        },
        trimSd: {
            type: 'number',
            title: 'Trim Standard Deviation',
            description: 'The standard deviation among pixels within a border when trim=auto.'
        },
        trimTol: {
            type: 'number',
            title: 'Trim Tolerance',
            description: 'The color tolerance threshold as a percentage.'
        },
        // Watermark
        mark: {
            type: 'string',
            title: 'Watermark Image URL',
            description: 'Adds a watermark to the image.'
        },
        markAlign: {
            type: 'string',
            title: 'Watermark Align',
            description: 'Specifies the alignment of the watermark.'
        },
        markAlpha: {
            type: 'integer',
            title: 'Watermark Alpha',
            description: 'Adjusts the alpha transparency of the watermark image.'
        },
        markFit: {
            enum: ['clip', 'crop', 'max', 'scale'],
            title: 'Watermark Fit Mode',
            description: 'Controls how the watermark image is fitted to its target dimensions.'
        },
        markH: {
            type: 'string',
            title: 'Watermark Height',
            description: 'Specifies the watermark height.'
        },
        markIfMinHeight: {
            type: 'integer',
            title: 'Watermark If Minimum Height',
            description: 'Specifies the minimum height the source image must have for the watermark to be applied.  If the image is smaller than this value, the watermark will not be applied.'
        },
        markIfMinWidth: {
            type: 'integer',
            title: 'Watermark If Minimum Width',
            description: 'Specifies the minimum width the source image must have for the watermark to be applied. If the image is smaller than this value, the watermark will not be applied.'
        },
        markPad: {
            type: 'integer',
            title: 'Watermark Padding',
            description: 'Adds padding, in pixels, around the watermark.'
        },
        markRot: {
            type: 'integer',
            title: 'Watermark Rotation',
            description: 'Controls the rotation of a watermark.'
        },
        markScale: {
            type: 'number',
            title: 'Watermark Scale',
            description: 'Scales the watermark relative to the base image.'
        },
        markTile: {
            enum: ['grid'],
            title: 'Watermark Tile',
            description: 'Tiles the watermark on top of the image in the requested pattern.'
        },
        markW: {
            type: 'string',
            title: 'Watermark Width',
            description: 'Specifies the watermark width.'
        },
        markX: {
            type: 'integer',
            title: 'Watermark X Position',
            description: 'Positions the watermark on the x-axis.'
        },
        markY: {
            type: 'integer',
            title: 'Watermark Y Position',
            description: 'Positions the watermark on the y-axis.'
        }
    },
    required: [],
    additionalProperties: false
};
export const validate = createTypedValidator(schema);
