{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/deploystack-configuration/latest.json",
  "title": "DeployStack Configuration Schema",
  "description": "Configuration schema for DeployStack applications",
  "x-lintel": {
    "source": "https://cdnx.deploystack.io/schema/config.yml.json",
    "sourceSha256": "47b8c8cd47222f23a86617f8ca6cff532aee11c41f2e7a3679a95a5bff651cc9",
    "fileMatch": [
      "**/.deploystack/config.yml",
      "**/.deploystack/config.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "application": {
      "type": "object",
      "description": "Application metadata and settings",
      "properties": {
        "logo": {
          "type": "string",
          "description": "Path to the application logo. Can be a local file relative to .deploystack directory or an external URL. Supports PNG, WEBP, or JPG formats.",
          "pattern": "^(https?://.*|.*)\\.(?:png|svg|jpg|jpeg|webp)$"
        },
        "name": {
          "type": "string",
          "description": "Application name for display in catalogs and deployment interfaces (maximum 40 characters)",
          "maxLength": 40
        },
        "description": {
          "type": "string",
          "description": "Brief description of your application (maximum 500 characters)",
          "maxLength": 500
        }
      }
    },
    "deployment": {
      "type": "object",
      "description": "Deployment configuration including branch settings",
      "properties": {
        "branches": {
          "type": "object",
          "description": "Configuration for multiple branch deployment support",
          "minProperties": 1,
          "patternProperties": {
            "^[a-zA-Z0-9._-]+$": {
              "type": "object",
              "description": "Branch-specific configuration",
              "properties": {
                "label": {
                  "type": "string",
                  "description": "Display label for the branch in UI elements",
                  "maxLength": 20
                },
                "description": {
                  "type": "string",
                  "description": "Detailed description of the branch version",
                  "maxLength": 100
                },
                "active": {
                  "type": "boolean",
                  "description": "Whether this branch is active for deployment",
                  "default": true
                },
                "priority": {
                  "type": "integer",
                  "description": "Optional priority for ordering in UI (lower numbers appear first)",
                  "minimum": 1
                },
                "exclude_providers": {
                  "type": "array",
                  "description": "List of cloud providers to exclude from template generation for this branch",
                  "items": {
                    "type": "string",
                    "enum": [
                      "aws",
                      "rnd",
                      "dop"
                    ],
                    "description": "Provider code to exclude (aws: AWS CloudFormation, rnd: Render.com, dop: DigitalOcean)"
                  },
                  "uniqueItems": true
                },
                "serviceConnections": {
                  "type": "object",
                  "description": "Configuration for service-to-service communication",
                  "properties": {
                    "mappings": {
                      "type": "array",
                      "description": "Defines relationships between services for connection configuration",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fromService": {
                            "type": "string",
                            "description": "Service that needs to connect to another service"
                          },
                          "toService": {
                            "type": "string",
                            "description": "Service being connected to"
                          },
                          "environmentVariables": {
                            "type": "array",
                            "description": "Environment variable names that reference the target service",
                            "items": {
                              "type": "string"
                            }
                          },
                          "property": {
                            "type": "string",
                            "description": "Type of connection property to reference (e.g., 'connectionString', 'hostport')",
                            "default": "hostport",
                            "enum": [
                              "connectionString",
                              "hostport",
                              "host",
                              "port"
                            ]
                          }
                        },
                        "required": [
                          "fromService",
                          "toService",
                          "environmentVariables"
                        ]
                      }
                    }
                  },
                  "required": [
                    "mappings"
                  ]
                }
              },
              "required": [
                "label"
              ]
            }
          }
        }
      }
    }
  }
}
