{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://base.akulich.dev/api/v1/product.schema.json",
  "title": "BASE public product",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "integer",
      "const": 1
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "pattern": "\\S"
    },
    "locale": {
      "type": "string",
      "const": "ru"
    },
    "canonicalUrl": {
      "type": "string",
      "minLength": 1,
      "pattern": "^https?://[^/\\s@]+(?:[/?#]|$)",
      "format": "uri"
    },
    "officialUrl": {
      "type": "string",
      "minLength": 1,
      "pattern": "^https?://[^/\\s@]+(?:[/?#]|$)",
      "format": "uri"
    },
    "isCatalog": {
      "type": "boolean"
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "pattern": "\\S"
    },
    "tasks": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "\\S"
      },
      "minItems": 1
    },
    "categoryIds": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "\\S"
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "subcategoryIds": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "\\S"
      },
      "minItems": 0,
      "uniqueItems": true
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "\\S"
      },
      "minItems": 0,
      "uniqueItems": true
    },
    "aliases": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "\\S"
      },
      "minItems": 0,
      "uniqueItems": true
    },
    "platforms": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "\\S"
      },
      "minItems": 0,
      "uniqueItems": true
    },
    "stack": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "\\S"
      },
      "minItems": 0,
      "uniqueItems": true
    },
    "compatibility": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S"
    },
    "pricing": {
      "type": "string",
      "enum": [
        "free",
        "freemium",
        "paid",
        "unknown"
      ]
    },
    "freeUsage": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S"
    },
    "paidUsage": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S"
    },
    "license": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S"
    },
    "selectionGuide": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "purpose": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "chooseWhen": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "minItems": 1
        },
        "considerInstead": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "minItems": 0
        },
        "requirements": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "minItems": 0
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "minItems": 0
        },
        "faq": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "question": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              },
              "answer": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              }
            },
            "required": [
              "question",
              "answer"
            ],
            "additionalProperties": false
          },
          "minItems": 1
        },
        "related": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
              },
              "reason": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              }
            },
            "required": [
              "id",
              "reason"
            ],
            "additionalProperties": false
          },
          "minItems": 0
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "^https?://[^/\\s@]+(?:[/?#]|$)",
            "format": "uri"
          },
          "minItems": 1,
          "uniqueItems": true
        }
      },
      "required": [
        "purpose",
        "chooseWhen",
        "considerInstead",
        "requirements",
        "limitations",
        "faq",
        "related",
        "sources"
      ],
      "additionalProperties": false
    },
    "selectionCheckedAt": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S",
      "format": "date"
    },
    "applicationGuide": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "goal": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "inputs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "minItems": 1
        },
        "steps": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "minItems": 1
        },
        "checks": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "minItems": 1
        }
      },
      "required": [
        "goal",
        "inputs",
        "steps",
        "checks"
      ],
      "additionalProperties": false
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "^https?://[^/\\s@]+(?:[/?#]|$)",
        "format": "uri"
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "checkedAt": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S",
      "format": "date"
    },
    "reviewScope": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S"
    },
    "relatedIds": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
      },
      "minItems": 0,
      "uniqueItems": true
    },
    "dataVersion": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-f0-9]{20}$"
    },
    "type": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S"
    },
    "kind": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S"
    },
    "pricingNote": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S"
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "pattern": "\\S"
    },
    "labeledSources": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "minLength": 1,
            "pattern": "^https?://[^/\\s@]+(?:[/?#]|$)",
            "format": "uri"
          },
          "label": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "pattern": "\\S"
          }
        },
        "required": [
          "url",
          "label"
        ],
        "additionalProperties": false
      },
      "minItems": 0
    },
    "licenseGuides": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "scope": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "pattern": "\\S"
          },
          "summary": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "pattern": "^https?://[^/\\s@]+(?:[/?#]|$)",
            "format": "uri"
          }
        },
        "required": [
          "id",
          "title",
          "scope",
          "summary",
          "url"
        ],
        "additionalProperties": false
      },
      "minItems": 0
    },
    "entryIds": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
      },
      "minItems": 0,
      "uniqueItems": true
    },
    "composition": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "contents": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "minItems": 0
        },
        "tasks": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          },
          "minItems": 0
        },
        "reviewedIds": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "reviewNote": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "pattern": "\\S"
        }
      },
      "required": [
        "contents",
        "tasks",
        "reviewedIds",
        "reviewNote"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schemaVersion",
    "id",
    "name",
    "locale",
    "canonicalUrl",
    "officialUrl",
    "isCatalog",
    "description",
    "tasks",
    "categoryIds",
    "subcategoryIds",
    "tags",
    "aliases",
    "platforms",
    "stack",
    "compatibility",
    "pricing",
    "freeUsage",
    "paidUsage",
    "license",
    "selectionGuide",
    "selectionCheckedAt",
    "applicationGuide",
    "sources",
    "checkedAt",
    "reviewScope",
    "relatedIds",
    "dataVersion"
  ],
  "additionalProperties": false
}
