{
  "title": "Vertra Cloud template manifest v1",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
    },
    "version": {
      "type": "string",
      "maxLength": 64,
      "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
    },
    "name": {
      "type": "object",
      "properties": {
        "pt-br": {
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        },
        "en": {
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        },
        "es": {
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        }
      },
      "required": [
        "pt-br"
      ],
      "additionalProperties": false
    },
    "description": {
      "type": "object",
      "properties": {
        "pt-br": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "en": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "es": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "pt-br"
      ],
      "additionalProperties": false
    },
    "category": {
      "type": "string",
      "enum": [
        "automation",
        "ai-agents",
        "bots",
        "apis",
        "cms",
        "monitoring",
        "starters",
        "databases",
        "other"
      ]
    },
    "tags": {
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9-]{0,29}$"
      }
    },
    "icon": {
      "type": "string",
      "maxLength": 255,
      "pattern": "^(?!.*(?:^|\\/)\\.\\.(?:\\/|$))[A-Za-z0-9._/-]+\\.(?:svg|png)$"
    },
    "links": {
      "type": "object",
      "properties": {
        "website": {
          "type": "string",
          "maxLength": 512,
          "pattern": "^https?:\\/\\/\\S+$"
        },
        "docs": {
          "type": "string",
          "maxLength": 512,
          "pattern": "^https?:\\/\\/\\S+$"
        },
        "source": {
          "type": "string",
          "maxLength": 512,
          "pattern": "^https?:\\/\\/\\S+$"
        },
        "license": {
          "type": "string",
          "maxLength": 512,
          "pattern": "^https?:\\/\\/\\S+$"
        }
      },
      "additionalProperties": false
    },
    "landing": {
      "type": "string",
      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
    },
    "min_plan": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "inputs": {
      "maxItems": 40,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "secret",
              "select",
              "boolean",
              "number",
              "url",
              "email"
            ]
          },
          "label": {
            "type": "object",
            "properties": {
              "pt-br": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "en": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "es": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              }
            },
            "required": [
              "pt-br"
            ],
            "additionalProperties": false
          },
          "help": {
            "type": "object",
            "properties": {
              "pt-br": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "en": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "es": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              }
            },
            "required": [
              "pt-br"
            ],
            "additionalProperties": false
          },
          "required": {
            "type": "boolean"
          },
          "default": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 3072
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          },
          "validation": {
            "type": "object",
            "properties": {
              "regex": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "min": {
                "type": "number"
              },
              "max": {
                "type": "number"
              },
              "min_length": {
                "type": "integer",
                "minimum": 0,
                "maximum": 3072
              },
              "max_length": {
                "type": "integer",
                "minimum": 1,
                "maximum": 3072
              }
            },
            "additionalProperties": false
          },
          "generate": {
            "type": "string",
            "pattern": "^(?:random:(?:[89]|[1-9]\\d|1[01]\\d|12[0-8])|uuid)$"
          },
          "editable": {
            "type": "boolean"
          },
          "when": {
            "type": "object",
            "properties": {
              "input": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
              },
              "equals": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 3072
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  }
                ]
              }
            },
            "required": [
              "input",
              "equals"
            ],
            "additionalProperties": false
          },
          "options": {
            "maxItems": 25,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "label": {
                  "type": "object",
                  "properties": {
                    "pt-br": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "en": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    },
                    "es": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": [
                    "pt-br"
                  ],
                  "additionalProperties": false
                },
                "sets": {
                  "type": "object",
                  "properties": {
                    "services": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "enum": [
                          "on",
                          "off"
                        ]
                      }
                    },
                    "env": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255,
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                        },
                        "additionalProperties": {
                          "type": "string",
                          "maxLength": 3072
                        }
                      }
                    },
                    "ram_extra": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 262144
                      }
                    }
                  },
                  "additionalProperties": false
                }
              },
              "required": [
                "value"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "type",
          "label"
        ],
        "additionalProperties": false
      }
    },
    "services": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
      },
      "additionalProperties": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "source": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "code",
                      "image"
                    ]
                  },
                  "image": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "path": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "context": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              "language": {
                "type": "string",
                "enum": [
                  "javascript",
                  "typescript",
                  "bun",
                  "python",
                  "static",
                  "php",
                  "go",
                  "ruby",
                  "java",
                  "rust",
                  "deno",
                  "dotnet",
                  "elixir"
                ]
              },
              "runtime_version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "main": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              },
              "build": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "start": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "port": {
                "type": "integer",
                "minimum": 1,
                "maximum": 65535
              },
              "ram": {
                "type": "object",
                "properties": {
                  "min": {
                    "type": "integer",
                    "minimum": 16,
                    "maximum": 262144
                  },
                  "recommended": {
                    "type": "integer",
                    "minimum": 16,
                    "maximum": 262144
                  },
                  "max": {
                    "type": "integer",
                    "minimum": 16,
                    "maximum": 262144
                  }
                },
                "required": [
                  "min",
                  "recommended"
                ],
                "additionalProperties": false
              },
              "web": {
                "type": "string",
                "enum": [
                  "required",
                  "optional",
                  "none"
                ]
              },
              "env": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                },
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 3072
                }
              },
              "env_hidden": {
                "maxItems": 256,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                }
              },
              "healthcheck": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "pattern": "^\\/\\S*$"
                  },
                  "timeout": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 900
                  }
                },
                "required": [
                  "timeout"
                ],
                "additionalProperties": false
              },
              "deploy": {
                "type": "object",
                "properties": {
                  "zero_downtime": {
                    "type": "object",
                    "properties": {
                      "default": {
                        "type": "string",
                        "enum": [
                          "auto",
                          "on",
                          "off"
                        ]
                      },
                      "locked": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "default"
                    ],
                    "additionalProperties": false
                  },
                  "auto_rollback": {
                    "type": "object",
                    "properties": {
                      "default": {
                        "type": "boolean"
                      },
                      "locked": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "default"
                    ],
                    "additionalProperties": false
                  },
                  "rollback": {
                    "type": "object",
                    "properties": {
                      "with_data": {
                        "type": "string",
                        "enum": [
                          "required",
                          "optional"
                        ]
                      }
                    },
                    "required": [
                      "with_data"
                    ],
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              },
              "connections": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "private": {
                      "type": "string",
                      "const": "required"
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "source",
              "ram",
              "web"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "database": {
                "type": "string",
                "enum": [
                  "postgres",
                  "mysql",
                  "mongodb",
                  "redis"
                ]
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              },
              "ram": {
                "type": "object",
                "properties": {
                  "min": {
                    "type": "integer",
                    "minimum": 16,
                    "maximum": 262144
                  },
                  "recommended": {
                    "type": "integer",
                    "minimum": 16,
                    "maximum": 262144
                  },
                  "max": {
                    "type": "integer",
                    "minimum": 16,
                    "maximum": 262144
                  }
                },
                "required": [
                  "min",
                  "recommended"
                ],
                "additionalProperties": false
              },
              "when": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
                  },
                  "equals": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 3072
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      }
                    ]
                  }
                },
                "required": [
                  "input",
                  "equals"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "database",
              "ram"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "blob": {
                "type": "object",
                "properties": {
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "private",
                      "public"
                    ]
                  }
                },
                "additionalProperties": false
              },
              "when": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
                  },
                  "equals": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 3072
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      }
                    ]
                  }
                },
                "required": [
                  "input",
                  "equals"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "blob"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "permissions": {
      "type": "object",
      "properties": {
        "code": {
          "type": "object",
          "properties": {
            "view": {
              "type": "boolean"
            },
            "edit": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        },
        "ram": {
          "type": "object",
          "properties": {
            "change": {
              "type": "boolean"
            },
            "below_min": {
              "type": "boolean"
            },
            "above_max": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        },
        "env": {
          "type": "object",
          "properties": {
            "add": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        },
        "commands": {
          "type": "object",
          "properties": {
            "edit": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        },
        "version": {
          "type": "object",
          "properties": {
            "selectable": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        },
        "share": {
          "type": "object",
          "properties": {
            "full_copy": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "outputs": {
      "maxItems": 16,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "label": {
            "type": "object",
            "properties": {
              "pt-br": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "en": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "es": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              }
            },
            "required": [
              "pt-br"
            ],
            "additionalProperties": false
          },
          "value": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              {
                "type": "object",
                "properties": {
                  "pt-br": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "en": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "es": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  }
                },
                "required": [
                  "pt-br"
                ],
                "additionalProperties": false
              }
            ]
          },
          "secret": {
            "type": "boolean"
          },
          "once": {
            "type": "boolean"
          }
        },
        "required": [
          "label",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "secrets": {
      "maxItems": 16,
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9_-]{0,39}$"
      }
    },
    "byok": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "version",
    "name",
    "description",
    "category",
    "services"
  ],
  "additionalProperties": false
}
