{
    "id": "http://www.ubisoft.com/ugc/acd/v1/quest/resources#",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "JSON Schema for Assassin's Creed Dynasty UGC",
    "Resource": {
        "oneOf": [
            {
                "$ref": "#/definitions/ResourceStaticEntity"
            },
            {
                "$ref": "#/definitions/ResourceNPCActor"
            },
            {
                "$ref": "#/definitions/ResourceDialogue"
            },
            {
                "$ref": "#/definitions/ResourceNetworkNode"
            },
            {
                "$ref": "#/definitions/ResourceProceduralActor"
            },
            {
                "$ref": "#/definitions/ResourceProceduralStaticEntity"
            }
        ]
    },
    "additionalProperties": false,
    "definitions": {
        "ResourceStaticEntity": {
            "type": "object",
            "properties": {
                "ID": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                },
                "Type": {
                    "type": "string",
                    "enum": [
                        "StaticEntity"
                    ]
                },
                "EntityTemplate": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/quest/entitytemplate#"
                },
                "Entity": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/ObjectId"
                },
                "Position": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/Vector3"
                },
                "ActivationTriggers": {
                    "$ref": "#/definitions/TriggerArray"
                },
                "DeactivationTriggers": {
                    "$ref": "#/definitions/TriggerArray"
                }
            },
            "oneOf": [
                {
                    "required": [
                        "ID",
                        "Type",
                        "EntityTemplate"
                    ]
                },
                {
                    "required": [
                        "ID",
                        "Type",
                        "Entity",
                        "Position"
                    ]
                }
            ],
            "additionalProperties": false
        },
        "ResourceNPCActor": {
            "type": "object",
            "properties": {
                "ID": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                },
                "Type": {
                    "type": "string",
                    "enum": [
                        "NPCActor"
                    ]
                },
                "GameObjectDescriptor": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/gameobjectdescriptorfilter#/Descriptor"
                },
                "Count": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/UInt64"
                },
                "Unique": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                },
                "Behaviour": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/quest/behaviours#/Behaviours"
                },
                "Search": {
                    "type": "object",
                    "EntityCenter": {
                        "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                    },
                    "Radius": {
                        "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/UInt64"
                    }
                },
                "ActivationTriggers": {
                    "$ref": "#/definitions/TriggerArray"
                },
                "DeactivationTriggers": {
                    "$ref": "#/definitions/TriggerArray"
                }
            },
            "oneOf": [
                {
                    "required": [
                        "ID",
                        "Type",
                        "Unique"
                    ]
                },
                {
                    "required": [
                        "ID",
                        "Type",
                        "GameObjectDescriptor",
                        "Search"
                    ]
                }
            ],
            "additionalProperties": false
        },
        "ResourceDialogue": {
            "type": "object",
            "properties": {
                "ID": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                },
                "Type": {
                    "type": "string",
                    "enum": [
                        "Dialogue"
                    ]
                },
                "Dialogue": {
                    "anyOf": [
                        {
                            "$ref": "http://www.ubisoft.com/ugc/acd/v1/dialogue/dialogue#"
                        },
                        {
                            "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                        }
                    ]
                },
                "PlayOnce": {
                    "type": "boolean"
                },
                "Push": {
                    "type": "boolean"
                },
                "Participants": {
                    "type": "array",
                    "minItem": 2,
                    "uniqueItems": true,
                    "items": {
                        "oneOf": [
                            {
                                "type": "object",
                                "properties": {
                                    "Mode": {
                                        "type": "string",
                                        "enum": [
                                            "Player"
                                        ]
                                    },
                                    "Actor": {
                                        "type": "string",
                                        "enum": [
                                            "Player"
                                        ]
                                    }
                                },
                                "required": [
                                    "Mode"
                                ],
                                "additionalProperties": false
                            },
                            {
                                "type": "object",
                                "properties": {
                                    "Mode": {
                                        "type": "string",
                                        "enum": [
                                            "TalkTarget",
                                            "AdditionalParticipant"
                                        ]
                                    },
                                    "Actor": {
                                        "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                                    },
                                    "StaticEntity": {
                                        "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                                    },
                                    "InteractOffset": {
                                        "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/Vector3"
                                    }
                                },
                                "required": [
                                    "Mode"
                                ],
                                "oneOf": [
                                    {
                                        "required": [
                                            "Actor"
                                        ]
                                    },
                                    {
                                        "required": [
                                            "StaticEntity"
                                        ]
                                    }
                                ],
                                "dependencies": {
                                    "InteractOffset": [
                                        "StaticEntity"
                                    ]
                                },
                                "additionalProperties": false
                            }
                        ]
                    }
                },
                "ActivationTriggers": {
                    "$ref": "#/definitions/TriggerArray"
                },
                "DeactivationTriggers": {
                    "$ref": "#/definitions/TriggerArray"
                }
            },
            "required": [
                "ID",
                "Type",
                "Dialogue",
                "Participants"
            ],
            "additionalProperties": false
        },
        "ResourceNetworkNode": {
            "type": "object",
            "properties": {
                "ID": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                },
                "Type": {
                    "type": "string",
                    "enum": [
                        "NetworkNode"
                    ]
                },
                "NodeID": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/ObjectId"
                },
                "ActivationTriggers": {
                    "$ref": "#/definitions/TriggerArray"
                },
                "DeactivationTriggers": {
                    "$ref": "#/definitions/TriggerArray"
                }
            },
            "required": [
                "ID",
                "Type",
                "NodeID"
            ],
            "additionalProperties": false
        },
        "TriggerArray": {
            "type": "array",
            "minItems": 1,
            "items": {
                "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
            }
        },
        "ResourceProceduralActor": {
            "type": "object",
            "properties": {
                "ID": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                },
                "Type": {
                    "type": "string",
                    "enum": [
                        "ProceduralActor"
                    ]
                },
                "EphemeralStationHost": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#ObjectId"
                },
              "GameObjectDescriptor": {
                "$ref": "http://www.ubisoft.com/ugc/acd/v1/gameobjectdescriptorfilter#/Descriptor"
              },
              "Group": {
                "type": "boolean"
              }
            },
            "required": [
                "ID",
                "Type",
                "EphemeralStationHost",
                "GameObjectDescriptor",
                "Group"
            ],
            "additionalProperties": false
        },
        "ResourceProceduralStaticEntity" : {
            "type": "object",
            "properties": {
                "ID": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#/RequiredString"
                },
                "Type": {
                    "type": "string",
                    "enum": [
                        "ProceduralStaticEntity"
                    ]
                },
                "EphemeralStationHost": {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#ObjectId"
                },
                "EntityLabel" : {
                    "$ref": "http://www.ubisoft.com/ugc/acd/v1/types#ObjectId"
                }
            },
            "required": [
                "ID",
                "Type",
                "EphemeralStationHost",
                "EntityLabel"
            ],
            "additionalProperties": false
        }
    }
}