{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://robotic.org/schemas/robotic.idea.v1.json",
  "title": "Robotic.org portable idea draft",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "kind",
    "lens",
    "title",
    "idea",
    "sources",
    "credit",
    "allowCredit"
  ],
  "properties": {
    "schemaVersion": {
      "const": "robotic.idea.v1"
    },
    "kind": {
      "enum": [
        "post",
        "feature",
        "note"
      ]
    },
    "lens": {
      "enum": [
        "real",
        "possible",
        "ridiculous",
        "not-applicable"
      ]
    },
    "title": {
      "type": "string",
      "minLength": 3,
      "maxLength": 100,
      "pattern": "^\\s*\\S[\\s\\S]{1,98}\\S\\s*$"
    },
    "idea": {
      "type": "string",
      "minLength": 10,
      "maxLength": 4000,
      "pattern": "^\\s*\\S[\\s\\S]{8,3998}\\S\\s*$"
    },
    "sources": {
      "type": "array",
      "maxItems": 5,
      "items": {
        "type": "string",
        "format": "uri",
        "pattern": "^https://[^/@\\s]+\\.[^/@\\s]+(?:[/?#][^\\s]*)?$",
        "maxLength": 1000
      }
    },
    "credit": {
      "type": "string",
      "maxLength": 100
    },
    "allowCredit": {
      "type": "boolean"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "allowCredit": {
            "const": true
          }
        }
      },
      "then": {
        "properties": {
          "credit": {
            "minLength": 1,
            "pattern": "\\S"
          }
        }
      }
    }
  ]
}
