{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.toolora.cn/agent/schema.json",
  "title": "Toolora published product",
  "type": "object",
  "required": [
    "id",
    "library",
    "canonical_url",
    "facts",
    "sources"
  ],
  "properties": {
    "company_id": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^c_[a-f0-9]{16}$"
    },
    "company_relations": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "fromType",
          "fromId",
          "companyId",
          "role",
          "scope",
          "primary"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "fromType": {
            "enum": [
              "product",
              "company"
            ]
          },
          "fromId": {
            "type": "string"
          },
          "companyId": {
            "type": "string",
            "pattern": "^c_[a-f0-9]{16}$"
          },
          "role": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "primary": {
            "type": "boolean"
          }
        }
      }
    },
    "source_locale": {
      "enum": [
        "zh",
        "en",
        "fr",
        "es",
        "ja",
        "ko"
      ]
    },
    "source_market": {
      "enum": [
        "global",
        "international",
        "CN",
        "JP",
        "KR",
        "FR",
        "ES",
        "HK"
      ]
    },
    "source_edition": {
      "enum": [
        "same-product",
        "regional",
        "international-only"
      ]
    },
    "source_verified_on": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "id": {
      "type": "string",
      "pattern": "^b[0-9]+$"
    },
    "library": {
      "enum": [
        "tools",
        "assets"
      ]
    },
    "canonical_url": {
      "type": "string",
      "format": "uri"
    },
    "last_verified": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "facts": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/fact"
      }
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "url",
          "kind"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "kind": {
            "type": "string"
          }
        }
      }
    }
  },
  "$defs": {
    "fact": {
      "type": "object",
      "required": [
        "value",
        "status",
        "sources"
      ],
      "properties": {
        "value": {},
        "status": {
          "enum": [
            "unknown",
            "unsourced",
            "publisher-stated",
            "official-stated",
            "editor-verified"
          ]
        },
        "verified_on": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "qualifier": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}