{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "OpenSCAD schema",
    "description": "Configuration for the OpenSCAD importer to import information for a step",
    "openscad": {
        "type": "object",
        "description": "A dictionary with openscad import data for different categories",
        "properties": {
            "images": {
                "type": "object",
                "description": "A dictionary for image imports",
                "patternProperties": {
                    "^([a-zA-Z][0-9a-zA-Z]*)$": {
                        "allOf": [
                            {
                                "$ref": "#/input"
                            },
                            {
                                "$ref": "#/image"
                            }
                        ]
                    }
                },
                "additionalProperties": false
            },
            "files": {
                "type": "object",
                "description": "A dictionary for file imports",
                "patternProperties": {
                    "^([a-zA-Z][0-9a-zA-Z]*)$": {
                        "allOf": [
                            {
                                "$ref": "#/input"
                            },
                            {
                                "$ref": "#/file"
                            }
                        ]
                    }
                },
                "additionalProperties": false
            },
            "parts": {
                "type": "object",
                "description": "A dictionary for part imports",
                "patternProperties": {
                    "^([a-zA-Z][0-9a-zA-Z]*)$": {
                        "allOf": [
                            {
                                "$ref": "#/input"
                            },
                            {
                                "$ref": "#/object"
                            }
                        ]
                    }
                },
                "additionalProperties": false
            },
            "tools": {
                "type": "object",
                "description": "A dictionary for tool imports",
                "patternProperties": {
                    "^([a-zA-Z][0-9a-zA-Z]*)$": {
                        "allOf": [
                            {
                                "$ref": "#/input"
                            },
                            {
                                "$ref": "#/object"
                            }
                        ]
                    }
                },
                "additionalProperties": false
            },
            "results": {
                "type": "object",
                "description": "A dictionary for result imports",
                "patternProperties": {
                    "^([a-zA-Z][0-9a-zA-Z]*)$": {
                        "allOf": [
                            {
                                "$ref": "#/input"
                            },
                            {
                                "$ref": "#/object"
                            }
                        ]
                    }
                },
                "additionalProperties": false
            }
        },
        "additionalProperties": false
    },
    "input": {
        "type": "object",
        "description": "The details of a module call, which yields an object when evaluated",
        "properties": {
            "scadfile": {
                "type": "string",
                "description": "The filename of the scad file"
            },
            "module": {
                "type": "string",
                "description": "Name of the module to be called, if omitted use full file"
            },
            "parameters": {
                "type": "array",
                "description": "Parameters to invoke module with"
            }
        },
        "required": [
            "scadfile"
        ]
    },
    "image": {
        "type": "object",
        "description": "Details about how the input should be transformed into a image",
        "properties": {
            "camera": {
                "type": "array",
                "description": "Position of the camera",
                "maxItems": 3,
                "minItems": 3,
                "items": {
                    "type": "number",
                    "description": "A coordinate"
                }
            },
            "size": {
                "type": "array",
                "description": "Size of the image",
                "maxItems": 2,
                "minItems": 2,
                "items": {
                    "type": "number",
                    "description": "A pixel number"
                }
            },
            "alt": {
                "type": "string",
                "description": "Textual description of the image"
            }
        }
    },
    "file": {
        "type": "object",
        "description": "Details about how the input should be transformed into a stl file",
        "properties": {
            "filename": {
                "type": "string",
                "description": "The filename of the exported stl"
            }
        },
        "required": [
            "filename"
        ]
    },
    "object": {
        "type": "object",
        "description": "Details about how the input should be transformed to an Object",
        "properties": {
            "name": {
                "type": "string",
                "description": "The name of the object"
            },
            "quantity": {
                "type": "number",
                "description": "Number of instances of this object",
                "default": 1
            },
            "optional": {
                "type": "boolean",
                "description": "If this object is strictly required",
                "default": false
            },
            "camera": {
                "type": "array",
                "description": "Position of the camera",
                "maxItems": 3,
                "minItems": 3,
                "items": {
                    "type": "number",
                    "description": "A coordinate"
                }
            },
            "size": {
                "type": "array",
                "description": "Size of the image",
                "maxItems": 2,
                "minItems": 2,
                "items": {
                    "type": "number",
                    "description": "A pixel number"
                }
            },
            "alt": {
                "type": "string",
                "description": "Textual description of the image"
            }
        },
        "required": [
            "name"
        ]
    },
    "properties": {
        "openscad": {
            "$ref": "#/openscad"
        },
        "input": {
            "$ref": "#/input"
        },
        "image": {
            "$ref": "#/image"
        },
        "file": {
            "$ref": "#/file"
        },
        "object": {
            "$ref": "#/object"
        }
    },
    "required": [
        "openscad",
        "input",
        "image",
        "file",
        "object"
    ]
}