{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "AeolusFormatSchema",
    "description": "Input JSON schema for Aeolus Universe.",
    "type": "object",
    "additionalProperties": false,
    "properties": {
        "version": {
            "type": "integer",
            "description": "Version number."
        },
        "component_types": {
            "description": "List of component types.",
            "type": "array",
            "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "name": {
                        "type": "string",
                        "description": "Name of the component type."
                    },
                    "consume": {
                        "type": "object",
                        "additionalProperties": {
                            "description": "The consume arity.",
                            "type": "integer"
                        },
                        "description": "Mapping (resource name -> consume arity) of resources consumed by the component type."
                    },
                    "states": {
                        "type": "array",
                        "minItems": 1,
                        "_uniqueItems": true,
                        "description": "List of the states of the component type.",
                        "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                                "name": {
                                    "type": "string",
                                    "description": "State name."
                                },
                                "initial": {
                                    "type": "boolean",
                                    "description": "Initial state (default = false if not present)."
                                },
                                "final": {
                                    "type": "boolean",
                                    "description": "Final state (default = false if not present)."
                                },
                                "provide": {
                                    "type": "object",
                                    "additionalProperties": {
                                        "oneOf": [
                                            {
                                                "description": "The arity of the provided port (finite).",
                                                "type": "integer"
                                            },
                                            {
                                                "description": "The arity of the provided port (infinite).",
                                                "enum": [
                                                    "inf",
                                                    "infinity",
                                                    "infinite",
                                                    "Inf",
                                                    "Infinity",
                                                    "Infinite",
                                                    "INF",
                                                    "INFINITY",
                                                    "INFINITE"
                                                ]
                                            }
                                        ]
                                    },
                                    "description": "Mapping (port name -> provide arity)."
                                },
                                "require": {
                                    "type": "object",
                                    "additionalProperties": {
                                        "description": "The arity of the required port.",
                                        "type": "integer"
                                    },
                                    "description": "Mapping (port -> require arity)."
                                },
                                "conflict": {
                                    "type": "array",
                                    "_uniqueItems": true,
                                    "items": {
                                        "description": "Conflict ports.",
                                        "type": "string"
                                    }
                                },
                                "successors": {
                                    "type": "array",
                                    "_uniqueItems": true,
                                    "items": {
                                        "type": "string",
                                        "description": "Successor states."
                                    }
                                }
                            },
                            "required": [
                                "name"
                            ]
                        }
                    }
                },
                "required": [
                    "name",
                    "states"
                ]
            },
            "minItems": 1,
            "_uniqueItems": true
        },
        "implementation": {
            "type": "object",
            "additionalProperties": {
                "type": "array",
                "description": "List of repository & package list pairs (dijunciton of possible implementations).",
                "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "repository": {
                            "type": "string"
                        },
                        "package": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "repository",
                        "package"
                    ]
                }
            },
            "_uniqueItems": true,
            "minItems": 1,
            "description": "Implementation mapping between components and packages belonging to a repository."
        },
        "repositories": {
            "type": "array",
            "_uniqueItems": true,
            "minItems": 1,
            "description": "Repositories description.",
            "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "packages": {
                        "type": "array",
                        "_uniqueItems": true,
                        "minItems": 1,
                        "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "depend": {
                                    "type": "array",
                                    "items": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "consume": {
                                    "type": "object",
                                    "additionalProperties": {
                                        "description": "The consume arity.",
                                        "type": "integer"
                                    },
                                    "description": "Mapping (resource name -> consume arity) of resources consumed by the component type."
                                },
                                "conflict": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            },
                            "required": [
                                "name"
                            ]
                        }
                    }
                },
                "required": [
                    "name"
                ]
            }
        }
    },
    "required": [
        "component_types"
    ]
}