{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "additionalProperties": false,
    "description": "A squadron for the X-Wing Miniatures Game in app-independent format for sharing, saving and moving between apps.",
    "properties": {
        "description": {
            "description": "A description of this squadron.",
            "type": "string"
        },
        "faction": {
            "description": "The faction this squadron belongs to.",
            "enum": [
                "rebel",
                "imperial",
                "scum"
            ],
            "type": "string"
        },
        "name": {
            "description": "The name of the squadron.",
            "type": "string"
        },
        "obstacles": {
            "description": "Array of three Strings, each being an identifier for the obstacle chosen for tournament use.",
            "items": {
                "type": "string"
            },
            "maxItems": 3,
            "minItems": 3,
            "type": "array"
        },
        "pilots": {
            "description": "The members of this squadron.",
            "items": {
                "additionalProperties": false,
                "minItems": 1,
                "properties": {
                    "hull": {
                        "description": "Hull value for the ship",
                        "type": "integer"
                    },
                    "multisection_id": {
                        "type": "integer"
                    },
                    "name": {
                        "pattern": "^[0-9a-z]+$",
                        "type": "string"
                    },
                    "points": {
                        "description": "The total points spent creating this squadron.",
                        "type": "integer"
                    },
                    "shields": {
                        "description": "Shield value for the ship",
                        "type": "integer"
                    },
                    "ship": {
                        "pattern": "^[0-9a-z]+$",
                        "type": "string"
                    },
                    "upgrades": {
                        "additionalProperties": true,
                        "minProperties": 1,
                        "patternProperties": {
                            "^[0-9a-z]+$": {
                                "items": {
                                    "pattern": "^[0-9a-z]+$",
                                    "type": "string"
                                },
                                "minItems": 1,
                                "type": "array"
                            }
                        },
                        "type": "object"
                    },
                    "vendor": {
                        "description": "An extensible object containing app-specific data. Developers should put extra data here under their own namespace.",
                        "maxProperties": 1,
                        "minProperties": 1,
                        "type": "object"
                    }
                },
                "required": [
                    "name",
                    "ship"
                ],
                "type": "object"
            },
            "type": "array"
        },
        "points": {
            "description": "The total points spent creating this squadron.",
            "type": "integer"
        },
        "vendor": {
            "description": "An extensible object containing app-specific data. Developers should put extra data here under their own namespace.",
            "maxProperties": 1,
            "minProperties": 1,
            "type": "object"
        },
        "version": {
            "description": "The version of the XWS spec used to create this data",
            "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
            "type": "string"
        }
    },
    "required": [
        "version",
        "faction",
        "pilots"
    ],
    "title": "X-Wing Squadron Format Schema",
    "type": "object"
}