{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "FIND Decision Evidence",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "tools",
    "scenarios",
    "review_notes"
  ],
  "properties": {
    "schema_version": {
      "const": 1
    },
    "tools": {
      "type": "array",
      "minItems": 6,
      "maxItems": 6,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "tool_id",
          "facts",
          "history"
        ],
        "properties": {
          "tool_id": {
            "enum": [
              "adobe-firefly",
              "midjourney",
              "runway",
              "elevenlabs",
              "suno",
              "canva-magic-studio"
            ]
          },
          "facts": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "value",
                "status",
                "evidence_type",
                "source_urls",
                "checked_at",
                "conditions",
                "scope",
                "source_note",
                "domain"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-z0-9_]+(?:\\.[a-z0-9_]+)*$"
                },
                "value": {
                  "type": [
                    "string",
                    "boolean",
                    "number",
                    "object",
                    "array"
                  ]
                },
                "status": {
                  "enum": [
                    "verified",
                    "unknown"
                  ]
                },
                "evidence_type": {
                  "enum": [
                    "official_statement",
                    "independent_test"
                  ]
                },
                "source_urls": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "uri",
                    "pattern": "^https://[^/@]+(?:/|$)"
                  },
                  "uniqueItems": true
                },
                "checked_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "conditions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "scope": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "predicates",
                    "required_facts",
                    "measure"
                  ],
                  "properties": {
                    "predicates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "key",
                          "op",
                          "value"
                        ],
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "op": {
                            "enum": [
                              "eq",
                              "in",
                              "gt_fact"
                            ]
                          },
                          "value": {}
                        },
                        "allOf": [
                          {
                            "if": {
                              "properties": {
                                "op": {
                                  "const": "in"
                                }
                              }
                            },
                            "then": {
                              "properties": {
                                "value": {
                                  "type": "array"
                                }
                              }
                            }
                          },
                          {
                            "if": {
                              "properties": {
                                "op": {
                                  "const": "gt_fact"
                                }
                              }
                            },
                            "then": {
                              "properties": {
                                "value": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        ]
                      }
                    },
                    "required_facts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "field",
                          "value"
                        ],
                        "properties": {
                          "field": {
                            "type": "string"
                          },
                          "value": {}
                        }
                      }
                    },
                    "measure": {
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  }
                },
                "source_note": {
                  "type": "string"
                },
                "domain": {
                  "enum": [
                    "capability",
                    "language",
                    "commercial",
                    "pricing",
                    "api",
                    "limits"
                  ]
                }
              },
              "allOf": [
                {
                  "if": {
                    "properties": {
                      "status": {
                        "const": "unknown"
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "value": {
                        "const": "unknown"
                      }
                    }
                  }
                },
                {
                  "if": {
                    "properties": {
                      "status": {
                        "const": "verified"
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "value": {
                        "not": {
                          "const": "unknown"
                        }
                      },
                      "source_urls": {
                        "minItems": 1
                      },
                      "checked_at": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              ]
            }
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "before",
                "after",
                "reason",
                "source",
                "checked_at"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "before": {},
                "after": {},
                "reason": {
                  "type": "string"
                },
                "source": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "uri",
                    "pattern": "^https://[^/@]+(?:/|$)"
                  }
                },
                "checked_at": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          }
        }
      }
    },
    "scenarios": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "tool_id",
          "input_conditions",
          "context",
          "title",
          "alternatives"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "tool_id": {
            "enum": [
              "adobe-firefly",
              "midjourney",
              "runway",
              "elevenlabs",
              "suno",
              "canva-magic-studio"
            ]
          },
          "input_conditions": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "field",
                "operator",
                "value"
              ],
              "properties": {
                "field": {
                  "type": "string",
                  "pattern": "^[a-z0-9_]+(?:\\.[a-z0-9_]+)*$"
                },
                "operator": {
                  "enum": [
                    "eq",
                    "contains",
                    "lte",
                    "gte"
                  ]
                },
                "value": {
                  "type": [
                    "string",
                    "boolean",
                    "number",
                    "object",
                    "array"
                  ]
                }
              }
            }
          },
          "context": {
            "type": "object"
          },
          "title": {
            "type": "string"
          },
          "alternatives": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      }
    },
    "review_notes": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "snapshot": {
      "type": "object",
      "required": [
        "evaluated_at",
        "valid_until",
        "cache_contract"
      ],
      "properties": {
        "evaluated_at": {
          "type": "string",
          "format": "date-time"
        },
        "valid_until": {
          "type": "string",
          "format": "date-time"
        },
        "cache_contract": {
          "type": "string"
        }
      }
    }
  },
  "x_snapshot": {
    "evaluated_at": "2026-10-11T11:43:30.082377+00:00",
    "valid_until": "2026-10-18T11:24:00+00:00",
    "cache_contract": "expires後は再判定必須。キャッシュ結果だけで推薦せず、unknownをeligibleへ補完しない。"
  }
}
