{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "localization": {
      "type": "object",
      "properties": {
        "sourceLocale": {
          "type": "string",
          "enum": [
            "ko",
            "en-US",
            "ja",
            "zh-TW"
          ]
        },
        "translations": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ko": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "summary": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160
                },
                "descriptionFormat": {
                  "type": "string",
                  "enum": [
                    "plain",
                    "markdown"
                  ]
                }
              },
              "additionalProperties": false
            },
            "en-US": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "summary": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160
                },
                "descriptionFormat": {
                  "type": "string",
                  "enum": [
                    "plain",
                    "markdown"
                  ]
                }
              },
              "additionalProperties": false
            },
            "ja": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "summary": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160
                },
                "descriptionFormat": {
                  "type": "string",
                  "enum": [
                    "plain",
                    "markdown"
                  ]
                }
              },
              "additionalProperties": false
            },
            "zh-TW": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "summary": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160
                },
                "descriptionFormat": {
                  "type": "string",
                  "enum": [
                    "plain",
                    "markdown"
                  ]
                }
              },
              "additionalProperties": false
            }
          }
        }
      },
      "additionalProperties": false
    },
    "viewMode": {
      "type": "string",
      "enum": [
        "flashcard",
        "graph",
        "both"
      ]
    },
    "tags": {
      "maxItems": 6,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "vocabulary",
          "qa",
          "ranking",
          "process",
          "graph",
          "knowledge"
        ]
      }
    },
    "topics": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "customRelations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "localizedLabels": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "ko": {
                "type": "string"
              },
              "en-US": {
                "type": "string"
              },
              "ja": {
                "type": "string"
              },
              "zh-TW": {
                "type": "string"
              }
            }
          },
          "id": {
            "type": "string",
            "pattern": "^custom:[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$"
          },
          "label": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "id",
          "label"
        ],
        "additionalProperties": false
      }
    },
    "protocolVersion": {
      "type": "number",
      "const": 2
    },
    "collectionId": {
      "type": "string",
      "minLength": 1
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "publishedAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "contentVersion": {
      "type": "string",
      "minLength": 1
    },
    "assets": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string",
            "minLength": 1
          },
          "path": {
            "type": "string",
            "minLength": 1
          },
          "sha256": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "assetId",
          "path",
          "sha256"
        ],
        "additionalProperties": false
      }
    },
    "cards": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "localization": {
            "type": "object",
            "properties": {
              "sourceLocale": {
                "type": "string",
                "enum": [
                  "ko",
                  "en-US",
                  "ja",
                  "zh-TW"
                ]
              },
              "translations": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "ko": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "summary": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      },
                      "descriptionFormat": {
                        "type": "string",
                        "enum": [
                          "plain",
                          "markdown"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "en-US": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "summary": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      },
                      "descriptionFormat": {
                        "type": "string",
                        "enum": [
                          "plain",
                          "markdown"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "ja": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "summary": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      },
                      "descriptionFormat": {
                        "type": "string",
                        "enum": [
                          "plain",
                          "markdown"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "zh-TW": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "summary": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      },
                      "descriptionFormat": {
                        "type": "string",
                        "enum": [
                          "plain",
                          "markdown"
                        ]
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            },
            "additionalProperties": false
          },
          "cardId": {
            "type": "string",
            "minLength": 1
          },
          "role": {
            "type": "string",
            "enum": [
              "none",
              "class",
              "instance",
              "property"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "summary": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "descriptionFormat": {
            "type": "string",
            "enum": [
              "plain",
              "markdown"
            ]
          },
          "images": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "localizedAltText": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "ko": {
                      "type": "string"
                    },
                    "en-US": {
                      "type": "string"
                    },
                    "ja": {
                      "type": "string"
                    },
                    "zh-TW": {
                      "type": "string"
                    }
                  }
                },
                "assetId": {
                  "type": "string",
                  "minLength": 1
                },
                "altText": {
                  "type": "string"
                },
                "sourcePath": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "assetId",
                "altText",
                "sourcePath"
              ],
              "additionalProperties": false
            }
          },
          "relations": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "subclass_of",
                        "instance_of",
                        "part_of",
                        "has_property",
                        "tier",
                        "equivalent_to",
                        "disjoint_with",
                        "prerequisite"
                      ]
                    },
                    {
                      "type": "string",
                      "pattern": "^custom:[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$"
                    }
                  ]
                },
                "targetCardId": {
                  "type": "string",
                  "minLength": 1
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string",
                      "maxLength": 500
                    }
                  ]
                },
                "unit": {
                  "type": "string",
                  "maxLength": 32
                }
              },
              "required": [
                "type",
                "targetCardId"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "cardId",
          "role",
          "title",
          "description"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "protocolVersion",
    "collectionId",
    "title",
    "description",
    "publishedAt",
    "contentVersion",
    "assets",
    "cards"
  ],
  "additionalProperties": false
}
