{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aisavingslab.example/data/directory.schema.json",
  "title": "AI Savings Lab directory",
  "description": "Entries describing an expense that AI might replace or reduce. Every number is either sourced (with URL and check date) or null. Null means 'not yet tested / not yet known', never zero.",
  "type": "object",
  "required": [
    "dataset_version",
    "dataset_last_reviewed",
    "license_note",
    "entries"
  ],
  "additionalProperties": false,
  "properties": {
    "dataset_version": {
      "type": "string"
    },
    "dataset_last_reviewed": {
      "type": "string",
      "format": "date"
    },
    "license_note": {
      "type": "string"
    },
    "entries": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/entry"
      }
    }
  },
  "$defs": {
    "nullableMoney": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0
    },
    "nullableDate": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "entry": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "title",
        "summary",
        "offering",
        "audience",
        "expense_category",
        "replaces",
        "ai_platforms",
        "planned_level",
        "setup_time_hours",
        "ai_cost_monthly_usd",
        "ai_cost_note",
        "potential_gross_annual_usd",
        "est_net_annual_usd",
        "human_oversight",
        "verification_status",
        "guide_access",
        "project_slug",
        "last_verified",
        "last_reviewed",
        "test_results",
        "notes"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$"
        },
        "title": {
          "type": "string",
          "minLength": 5
        },
        "summary": {
          "type": "string"
        },
        "offering": {
          "enum": [
            "Find it (agent comparison)",
            "Build it (replacement project)"
          ]
        },
        "audience": {
          "type": "array",
          "minItems": 1,
          "items": {
            "enum": [
              "Business",
              "Personal"
            ]
          },
          "uniqueItems": true
        },
        "expense_category": {
          "enum": [
            "Bookkeeping & accounting",
            "Receipts & expenses",
            "Client follow-up / CRM",
            "Invoicing & payments",
            "Social media",
            "Research & monitoring",
            "Travel",
            "Subscriptions & bills",
            "Scheduling",
            "Meetings & notes"
          ]
        },
        "replaces": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "name",
            "plan",
            "list_price_monthly_usd",
            "price_basis",
            "source_url",
            "price_checked"
          ],
          "properties": {
            "name": {
              "type": "string"
            },
            "plan": {
              "type": [
                "string",
                "null"
              ]
            },
            "list_price_monthly_usd": {
              "$ref": "#/$defs/nullableMoney"
            },
            "price_basis": {
              "type": "string",
              "description": "How the price was obtained, billing terms, and caveats."
            },
            "source_url": {
              "type": [
                "string",
                "null"
              ],
              "pattern": "^https://"
            },
            "price_checked": {
              "$ref": "#/$defs/nullableDate"
            }
          }
        },
        "ai_platforms": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "planned_level": {
          "enum": [
            "Beginner",
            "Intermediate",
            "Advanced"
          ],
          "description": "Editorial pre-test classification of the build, not a measured result."
        },
        "setup_time_hours": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "description": "Measured setup time. Null until tested."
        },
        "ai_cost_monthly_usd": {
          "$ref": "#/$defs/nullableMoney"
        },
        "ai_cost_note": {
          "type": "string"
        },
        "potential_gross_annual_usd": {
          "$ref": "#/$defs/nullableMoney",
          "description": "list_price_monthly_usd x 12. Before AI cost, setup time and maintenance. Null when no sourced price."
        },
        "est_net_annual_usd": {
          "type": [
            "number",
            "null"
          ],
          "description": "Only filled once AI cost and time are known (tested or owner-documented)."
        },
        "human_oversight": {
          "enum": [
            "Low",
            "Medium",
            "High"
          ],
          "description": "Oversight we REQUIRE by policy for this kind of task (money, client contact, credentials = High)."
        },
        "verification_status": {
          "enum": [
            "Not yet tested",
            "Researched (vendor claims)",
            "Tested by AI Savings Lab",
            "Case study (owner-documented)"
          ]
        },
        "guide_access": {
          "enum": [
            "Free",
            "Paid"
          ]
        },
        "project_slug": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_verified": {
          "$ref": "#/$defs/nullableDate",
          "description": "Date of the last hands-on test. Null until tested."
        },
        "last_reviewed": {
          "type": "string",
          "format": "date"
        },
        "case_study_in_progress": {
          "type": "boolean"
        },
        "test_results": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "runs",
                "successful_runs",
                "test_dates",
                "report_url"
              ],
              "properties": {
                "runs": {
                  "type": "integer",
                  "minimum": 1
                },
                "successful_runs": {
                  "type": "integer",
                  "minimum": 0
                },
                "test_dates": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "date"
                  },
                  "minItems": 1
                },
                "report_url": {
                  "type": "string"
                }
              }
            }
          ]
        },
        "notes": {
          "type": "string"
        }
      }
    }
  }
}
