{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "additionalProperties": false,
  "description": "Configuration for safebox to deploy parameters to various parameter stores",
  "id": "https://json.schemastore.org/safebox-schema-v1.0.0.json",
  "properties": {
    "service": {
      "type": "string",
      "description": "Name of the service. parameters will be prefixed by the value provided"
    },
    "provider": {
      "type": "string",
      "enum": ["ssm", "secrets-manager"],
      "description": "Deploy parameters to the given provider. Eg. ssm, secrets-manager"
    },
    "region": {
      "anyOf": [
        {
          "enum": [
            "us-east-2",
            "us-east-1",
            "us-west-1",
            "us-west-2",
            "af-south-1",
            "ap-east-1",
            "ap-south-2",
            "ap-southeast-3",
            "ap-southeast-4",
            "ap-south-1",
            "ap-northeast-3",
            "ap-northeast-2",
            "ap-northeast-1",
            "ap-southeast-1",
            "ap-southeast-2",
            "ca-central-1",
            "eu-central-1",
            "eu-west-1",
            "eu-west-2",
            "eu-south-1",
            "eu-west-3",
            "eu-south-2",
            "eu-north-1",
            "eu-central-2",
            "me-south-1",
            "me-central-1",
            "sa-east-1",
            "us-gov-east-1",
            "us-gov-west-1"
          ]
        },
        {
          "type": "string"
        }
      ],
      "description": "Region to deploy the parameters to. Eg. us-east-1"
    },
    "prefix": {
      "type": "string",
      "description": "Prefix to apply to all parameters. Does not apply for shared",
      "default": "/<stage>/<service>/"
    },
    "generate": {
      "type": "array",
      "description": "Generate different files based on the parameter name and values",
      "items": {
        "type": "object",
        "required": ["type", "path"],
        "properties": {
          "type": {
            "enum": ["json", "yaml", "dotenv", "types-node"],
            "description": "Type of file to generate"
          },
          "path": {
            "type": "string",
            "description": "Full path with filename for writing the output"
          }
        }
      }
    },
    "cloudformation-stacks": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Cloudformation stack names. Any output values from the stacks can be interpolated. Eg. DB_NAME: \"{{.myDbName}}\"\nmyDbName is the output of one of the cloudformation stacks"
    },
    "config": {
      "type": "object",
      "description": "Parameters to deploy as non secret. You can also specify stage specific key value pairs. Same key in the defaults will be ignored and stage specific value will be used.",
      "properties": {
        "defaults": {
          "type": "object",
          "description": "parameter name and value. Output is /<stage>/<service>/<param name>"
        },
        "shared": {
          "type": "object",
          "description": "Params that are to be shared between multiple services. The parameter name won't be prefixed by service name. Output is /<stage>/shared/<param name>"
        }
      }
    },
    "secret": {
      "type": "object",
      "description": "Parameters to deploy as secret. You cannot specify stage specific key value pairs. Value is the description. You will need to run safebox deploy in prompt mode to provide the actual value.",
      "properties": {
        "defaults": {
          "type": "object",
          "description": "parameter name and value. Output is /<stage>/<service>/<param name>"
        },
        "shared": {
          "type": "object",
          "description": "Params that are to be shared between multiple services. The parameter name won't be prefixed by service name. Output is /<stage>/shared/<param name>"
        }
      }
    }
  },
  "required": ["service", "provider"],
  "type": "object"
}
