{
    "$id": "https://example.com/schema.json",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "description": "complete criteria schema",
    "type": "object",
    "additionalProperties": false,
    "patternProperties": {
        "^[\\w_]+-[\\w_]+-[\\w_]+$": {
            "oneOf": [
                {
                    "$ref": "#/definitions/gras"
                },
                {
                    "$ref": "#/definitions/youtubereporting"
                },
                {
                    "$ref": "#/definitions/general"
                }
            ]
        }
    },
    "definitions": {
        "gras": {
            "type": "object",
            "required": ["partner", "licensor", "report_type", "complete_criteria"],
            "properties": {
                "partner": {
                    "type": "string",
                    "enum": ["gras"]
                },
                "licensor": {
                    "type": "string"
                },
                "report_type": {
                    "type": "string"
                },
                "complete_criteria": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": ["context", "required"],
                        "properties": {
                            "context": {
                                "type": "string"
                            },
                            "required": {
                                "type": "boolean"
                            },
                            "query": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        },
        "youtubereporting": {
            "type": "object",
            "required": ["partner", "licensor", "report_type", "complete_criteria"],
            "properties": {
                "partner": {
                    "type": "string",
                    "enum": ["youtubereporting"]
                },
                "licensor": {
                    "type": "string"
                },
                "report_type": {
                    "type": "string"
                },
                "complete_criteria": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": ["context", "required", "job_id"],
                        "properties": {
                            "context": {
                                "type": "string"
                            },
                            "required": {
                                "type": "boolean"
                            },
                            "job_id": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        },
        "general": {
            "type": "object",
            "required": ["partner", "licensor", "report_type", "complete_criteria"],
            "properties": {
                "partner": {
                    "type": "string",
                    "enum": [
                        "amazonadsupported",
                        "amazonmusicunlimited",
                        "amazonprime",
                        "apple",
                        "appreciationengine",
                        "sme_max",
                        "spotify",
                        "vevo",
                        "youtubemusic",
                        "apollo",
                        "tiktokreporting",
                        "linkfire",
                        "chartmetric",
                        "brandwatch",
                        "salesforce_marketing_cloud",
                        "partnerize"
                    ]
                },
                "licensor": {
                    "type": "string"
                },
                "report_type": {
                    "type": "string"
                },
                "complete_criteria": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": ["context", "required"],
                        "properties": {
                            "context": {
                                "type": "string"
                            },
                            "required": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            }
        }
    }
}
