{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Portfolio",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "type": "integer",
      "const": 1
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "apps": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/App"
      }
    },
    "projects": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Project"
      }
    },
    "developerTools": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/DeveloperTool"
      }
    },
    "collections": {
      "$ref": "#/definitions/Collections"
    }
  },
  "required": [
    "schemaVersion",
    "updatedAt",
    "apps",
    "projects",
    "developerTools",
    "collections"
  ],
  "definitions": {
    "Id": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
    },
    "Platform": {
      "type": "string",
      "enum": [
        "macos",
        "windows",
        "linux",
        "ios",
        "android",
        "web"
      ]
    },
    "Link": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "enum": [
            "website",
            "github",
            "app-store",
            "play-store",
            "download",
            "documentation"
          ]
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "url": {
          "$ref": "#/definitions/WebUrl"
        },
        "platform": {
          "$ref": "#/definitions/Platform"
        }
      },
      "required": [
        "type",
        "label",
        "url"
      ]
    },
    "HttpsUrl": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://[^\\s]+$"
    },
    "App": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/definitions/Id"
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "color": {
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "stack": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          }
        },
        "isDemo": {
          "type": "boolean"
        },
        "links": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Link"
          }
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "tagline": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "category": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "icon": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "iconUrl": {
          "$ref": "#/definitions/HttpsUrl"
        },
        "status": {
          "enum": [
            "development",
            "beta",
            "released",
            "archived",
            null
          ]
        },
        "platforms": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Platform"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "features": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          }
        },
        "iconPath": {
          "$ref": "#/definitions/IconPath"
        },
        "devices": {
          "$ref": "#/definitions/Devices"
        },
        "developmentModels": {
          "$ref": "#/definitions/DevelopmentModels"
        }
      },
      "required": [
        "id",
        "description",
        "color",
        "stack",
        "isDemo",
        "links",
        "name",
        "tagline",
        "category",
        "icon",
        "status",
        "platforms",
        "features"
      ]
    },
    "Period": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "start": {
          "type": "string",
          "pattern": "^\\d{4}(?:-(?:0[1-9]|1[0-2]))?$"
        },
        "end": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^\\d{4}(?:-(?:0[1-9]|1[0-2]))?$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "start",
        "end"
      ]
    },
    "Project": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/definitions/Id"
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "color": {
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "stack": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          }
        },
        "isDemo": {
          "type": "boolean"
        },
        "links": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Link"
          }
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "category": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "summary": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "role": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "pattern": "\\S"
            },
            {
              "type": "null"
            }
          ]
        },
        "period": {
          "anyOf": [
            {
              "$ref": "#/definitions/Period"
            },
            {
              "type": "null"
            }
          ]
        },
        "contributions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          }
        },
        "iconPath": {
          "$ref": "#/definitions/IconPath"
        },
        "devices": {
          "$ref": "#/definitions/Devices"
        },
        "developmentModels": {
          "$ref": "#/definitions/DevelopmentModels"
        },
        "icon": {
          "type": "string",
          "minLength": 1
        },
        "iconUrl": {
          "$ref": "#/definitions/HttpsUrl"
        }
      },
      "required": [
        "id",
        "description",
        "color",
        "stack",
        "isDemo",
        "links",
        "title",
        "category",
        "summary",
        "role",
        "period",
        "contributions"
      ]
    },
    "DeveloperTool": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/definitions/Id"
        },
        "command": {
          "$ref": "#/definitions/Id"
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "github": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://github\\.com/[A-Za-z0-9_.-]+(?:/[A-Za-z0-9_.-]+)?/?$"
        },
        "isDemo": {
          "type": "boolean"
        },
        "iconPath": {
          "$ref": "#/definitions/IconPath"
        },
        "devices": {
          "$ref": "#/definitions/Devices"
        },
        "developmentModels": {
          "$ref": "#/definitions/DevelopmentModels"
        },
        "githubKind": {
          "enum": [
            "profile",
            "repository"
          ]
        },
        "platforms": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "$ref": "#/definitions/Platform"
          }
        },
        "distribution": {
          "enum": [
            "binary",
            "source",
            "package"
          ]
        },
        "integrations": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "iconUrl": {
          "$ref": "#/definitions/HttpsUrl"
        }
      },
      "required": [
        "id",
        "command",
        "name",
        "description",
        "github",
        "isDemo"
      ]
    },
    "Collections": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "com": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "desktopApps": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Id"
              },
              "uniqueItems": true
            },
            "mobileApps": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Id"
              },
              "uniqueItems": true
            },
            "projects": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Id"
              },
              "uniqueItems": true
            },
            "developerTools": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Id"
              },
              "uniqueItems": true
            }
          },
          "required": [
            "desktopApps",
            "mobileApps",
            "projects",
            "developerTools"
          ]
        },
        "dev": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "apps": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Id"
              },
              "uniqueItems": true
            },
            "projects": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Id"
              },
              "uniqueItems": true
            }
          },
          "required": [
            "apps",
            "projects"
          ]
        }
      },
      "required": [
        "com",
        "dev"
      ]
    },
    "WebUrl": {
      "type": "string",
      "format": "uri",
      "pattern": "^https?://[^\\s]+$"
    },
    "IconPath": {
      "type": "string",
      "pattern": "^assets/icons/[a-z0-9][a-z0-9._-]*\\.(png|webp|jpg|jpeg|svg)$"
    },
    "Devices": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "enum": [
          "desktop",
          "mobile",
          "tablet",
          "e-reader"
        ]
      }
    },
    "DevelopmentModels": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1,
        "pattern": "\\S"
      }
    }
  }
}
