{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "aws_profile": {
            "type": "string",
            "description": "(optional) AWS Profile can be specified here (but normally it's specified via AWS_PROFILE env var)"
        },
        "aws_region": {
            "type": "string",
            "description": "(required) AWS Region of this environment should be specified here. Can be overridden by AWS_PROFILE env var or --aws-region flag."
        },
        "config_file": {
            "type": "string",
            "description": "(optional) Path to ize.toml config file can be specified, but normally it's read from the environment's directory automatically."
        },
        "env": {
            "type": "string",
            "description": "(optional) Environment name can be specified here. Normally it should be passed via `ENV` variable or --env flag."
        },
        "env_dir": {
            "type": "string",
            "description": "(optional) Environment directory can be specified here. Normally it's calculated automatically based on the directory structure convention."
        },
        "home": {
            "type": "string",
            "description": "(optional) User home directory can be specified here. Normally $HOME is used."
        },
        "ize_dir": {
            "type": "string",
            "description": "(optional) Ize directory can be specified here. Normally it's assumed to be .infra or .ize in the current repo."
        },
        "log_level": {
            "type": "string",
            "description": "(optional) Log level can be specified here. Possible levels: info, debug, trace, panic, warn, error, fatal(default). Can be overridden via IZE_LOG_LEVEL env var or via --log-level flag."
        },
        "namespace": {
            "type": "string",
            "description": "(required) Namespace of the project can be specified here. It is used as a base for all naming. It can be overridden by NAMESPACE env var or --namespace flag."
        },
        "plain_text": {
            "description": "(optional) Plain text output can be enabled here. Default is false. Can be overridden by IZE_PLAIN_TEXT env var or --plain-text flag.",
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "boolean"
                }
            ]
        },
        "prefer_runtime": {
            "type": "string",
            "description": "(optional) Prefer a specific runtime. (native or docker) (default 'native')"
        },
        "apps_path": {
            "type": "string",
            "description": "(optional) Path to apps directory can be set. By default apps are searched in 'apps' and 'projects' directories. This is needed in case your repo structure is not purely ize-structured (let's say you have 'src' repo in your dotnet app, as an example)"
        },
        "root_dir": {
            "type": "string",
            "description": "(optional) Project directory can be set here. By default it's the current directory, but in case you prefer to run ize from the outside of repo it may be useful (uncommon)."
        },
        "terraform_version": {
            "type": "string",
            "description": "(optional) Terraform version can be set here. 1.1.3 by default"
        },
        "docker_registry": {
            "type": "string",
            "description": "(optional) Docker registry can be set here. By default it uses ECR repo with the name of the service."
        },
        "tf_log_path": {
            "type": "string",
            "description": "(optional) TF_LOG_PATH can be set here."
        },
        "tag": {
            "type": "string",
            "description": "(optional) Tag can be set statically. Normally it is being constructed automatically based on the git revision."
        },
        "tf_log": {
            "type": "string",
            "description": "(optional) Terraform TF_LOG can be set here.  Can be TRACE, DEBUG, INFO, WARN or ERROR."
        },
        "custom_prompt": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "boolean"
                }
            ],
            "description": "(optional) Custom prompt can be enabled here for all console connections. Default: false."
        },
        "tunnel": {
            "type": "object",
            "properties": {
                "bastion_instance_id": {
                    "type": "string",
                    "description": "Bastion instance ID."
                },
                "forward_host": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "description": "Forward host."
                    }
                }
            },
            "description": "Tunnel configuration.",
            "additionalProperties": false
        },
        "app": {
            "deprecationMessage": "app block is deprecated",
            "id": "#/properties/app",
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/app"
                }
            },
            "description": "Apps configuration.",
            "additionalProperties": false
        },
        "ecs": {
            "id": "#/properties/ecs",
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/ecs"
                }
            },
            "description": "Ecs apps configuration.",
            "additionalProperties": false
        },
        "serverless": {
            "id": "#/properties/serverless",
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/serverless"
                }
            },
            "description": "Serverless apps configuration.",
            "additionalProperties": false
        },
        "alias": {
            "id": "#/properties/alias",
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/alias"
                }
            },
            "description": "(optional) Alias mode can be enabled here. This can be used to combine various apps via depends_on parameter.",
            "additionalProperties": false
        },
        "terraform": {
            "id": "#/properties/terraform",
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/terraform"
                }
            },
            "description": "Terraform configuration.",
            "additionalProperties": false
        },
        "infra": {
            "type": "object",
            "deprecationMessage": "infra block is deprecated",
            "properties": {
                "terraform": {
                    "type": "object",
                    "properties": {
                        "version": {
                            "type": "string",
                            "description": "(optional) Terraform version can be set here. 1.1.3 by default."
                        },
                        "terraform_version": {
                            "type": "string"
                        },
                        "state_bucket_region": {
                            "type": "string",
                            "description": "(optional) Terraform state bucket region can be specified here. Normally AWS_REGION is used here. Can be overridden via env vars or flags."
                        },
                        "state_bucket_name" : {
                            "type": "string",
                            "description": "(optional) Terraform state bucket name can be specified here. Normally it's generated and defaults to <NAMESPACE>-tf-state"
                        },
                        "state_name": {
                            "type": "string",
                            "description": "(optional) Terraform state name that will be used in the .tfstate file. Normally it's 'terraform' or state name."
                        },
                        "root_domain_name"   : {
                            "type": "string",
                            "description": "(optional) Root domain name can be set here. This is the main domain that will be passed to the terraform. Generally if your app lives at 'api.dev.nutcorp.net' the root domain is `nutcorp.net`"
                        },
                        "aws_region"   : {
                            "type": "string",
                            "description": "(optional) Terraform-specific AWS Region of this environment should be specified here. Normally global AWS_REGION is used."
                        },
                        "aws_profile"  : {
                            "type": "string",
                            "description": "(optional) Terraform-specific AWS profile (optional) can be specified here (but normally it should be inherited from a global AWS_PROFILE)."
                        }
                    },
                    "description": "Infrastructure configuration.",
                    "additionalProperties": false
                },
                "tunnel": {
                    "type": "object",
                    "properties": {
                        "bastion_instance_id": {
                            "type": "string",
                            "description": "Bastion instance ID."
                        },
                        "forward_host": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "description": "Forward host."
                            }
                        }
                    },
                    "description": "Tunnel configuration.",
                    "additionalProperties": false
                }
            },
            "required": [
                "terraform"
            ],
            "description": "Infrastructure configuration."
        }
    },
    "definitions": {
        "app": {
            "deprecationMessage": "app block is deprecated",
            "id": "#/definitions/app",
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "description": "app type"
                },
                "file": {
                    "type": "string",
                    "description": "(optional) Path to serverless file can be specified here. Normally it's serverless.yml in the app directory."
                },
                "node_version": {
                    "type": "string",
                    "description": "(optional) Node version that will be used by nvm can be specified here that. Default is v14."
                },
                "create_domain" : {
                    "type": "boolean",
                    "description": "(optional) Create domain for the serverless domain manager during the deployment."
                },
                "path"   : {
                    "type": "string",
                    "description": "(optional) Path to ecs app folder can be specified here. By default it's derived from apps path and app name."
                },
                "sls_node_modules_cache_mount"   : {
                    "type": "string",
                    "description": "(optional) SLS node_modules cache mount path can be specified here. It's used to store cache during CI/CD process."
                },
                "env"  : {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "description": "environment"
                    },
                    "description": "environments"
                },
                "unsafe": {
                    "type": "boolean",
                    "description": "(optional) Enables unsafe mode that increases deploy time on a cost of shorter healthcheck."
                },
                "image" : {
                    "type": "string",
                    "description": "(optional) Docker image can be specified here. By default it's derived from the app name."
                },
                "cluster"   : {
                    "type": "string",
                    "description": "(optional) ECS cluster can be specified here. By default it's derived from env & namespace"
                },
                "task_definition_revision"   : {
                    "type": "string",
                    "description": "(optional) Task definition revision can be specified here. By default latest revision is used to perform a deployment. Normally this parameter can be used via cli during specific deployment needs."
                },
                "timeout"  : {
                    "type": "integer",
                    "description": "(optional) ECS deployment timeout can be specified here."
                },
                "docker_registry"  : {
                    "type": "string",
                    "description": "(optional) Docker registry can be set here. By default it uses ECR repo with the name of the service."
                },
                "skip_deploy": {
                    "type": "boolean",
                    "description": "(optional) skip deploy app."
                },
                "depends_on": {
                    "type": "array",
                    "description": "(optional) expresses startup and shutdown dependencies between apps"
                }
            },
            "description": "App configuration.",
            "additionalProperties": false
        },
        "ecs": {
            "id": "#/definitions/ecs",
            "type": "object",
            "properties": {
                "path": {
                    "type": "string",
                    "description": "(optional) Path to ecs app folder can be specified here. By default it's derived from apps path and app name."
                },
                "unsafe": {
                    "type": "boolean",
                    "description": "(optional) Enables unsafe mode that increases deploy time on a cost of shorter healthcheck."
                },
                "image" : {
                    "type": "string",
                    "description": "(optional) Docker image can be specified here. By default it's derived from the app name."
                },
                "cluster"   : {
                    "type": "string",
                    "description": "(optional) ECS cluster can be specified here. By default it's derived from env & namespace"
                },
                "task_definition_revision" : {
                    "type": "string",
                    "description": "(optional) Task definition revision can be specified here. By default latest revision is used to perform a deployment. Normally this parameter can be used via cli during specific deployment needs."
                },
                "timeout" : {
                    "type": "integer",
                    "description": "(optional) ECS deployment timeout can be specified here."
                },
                "docker_registry"  : {
                    "type": "string",
                    "description": "(optional) Docker registry can be set here. By default it uses ECR repo with the name of the service."
                },
                "skip_deploy": {
                    "type": "boolean",
                    "description": "(optional) skip deploy app."
                },
                "icon": {
                    "type": "string",
                    "description": "(optional) set icon"
                },
                "aws_region"   : {
                    "type": "string",
                    "description": "(optional) ECS-specific AWS Region of this environment should be specified here. Normally global AWS_REGION is used."
                },
                "aws_profile"  : {
                    "type": "string",
                    "description": "(optional) ECS-specific AWS profile (optional) can be specified here (but normally it should be inherited from a global AWS_PROFILE)."
                },
                "depends_on": {
                    "type": "array",
                    "description": "(optional) expresses startup and shutdown dependencies between apps"
                }
            },
            "description": "Ecs app configuration.",
            "additionalProperties": false
        },
        "serverless": {
            "id": "#/definitions/serverless",
            "type": "object",
            "properties": {
                "file": {
                    "type": "string",
                    "description": "(optional) Path to serverless file can be specified here. Normally it's serverless.yml in the app directory."
                },
                "node_version": {
                    "type": "string",
                    "description": "(optional) Node version that will be used by nvm can be specified here that. Default is v14."
                },
                "create_domain" : {
                    "type": "boolean",
                    "description": "(optional) Create domain for the serverless domain manager during the deployment."
                },
                "path"   : {
                    "type": "string",
                    "description": "(optional) Path to the serverless app directory can be specified here. Normally it's derived from app directory and app name."
                },
                "sls_node_modules_cache_mount"   : {
                    "type": "string",
                    "description": "(optional) SLS node_modules cache mount path can be specified here. It's used to store cache during CI/CD process."
                },
                "env"  : {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "description": "environment"
                    },
                    "description": "environments"
                },
                "icon": {
                    "type": "string",
                    "description": "(optional) set icon"
                },
                "aws_region"   : {
                    "type": "string",
                    "description": "(optional) Serverless-specific AWS Region of this environment should be specified here. Normally global AWS_REGION is used."
                },
                "aws_profile"  : {
                    "type": "string",
                    "description": "(optional) Serverless-specific AWS profile (optional) can be specified here (but normally it should be inherited from a global AWS_PROFILE)."
                },
                "depends_on": {
                    "type": "array",
                    "description": "(optional) expresses startup and shutdown dependencies between apps"
                }
            },
            "description": "Serverless app configuration.",
            "additionalProperties": false
        },
        "alias": {
            "id": "#/definitions/alias",
            "type": "object",
            "properties": {
                "icon": {
                    "type": "string",
                    "description": "(optional) set icon"
                },
                "depends_on": {
                    "type": "array",
                    "description": "(optional) expresses startup and shutdown dependencies between apps"
                }
            },
            "description": "Alias configuration.",
            "additionalProperties": false
        },
        "terraform": {
            "id": "#/definitions/terraform",
            "type": "object",
            "properties": {
                "version": {
                    "type": "string",
                    "description": "(optional) Terraform version can be set here. 1.1.3 by default."
                },
                "state_bucket_region": {
                    "type": "string",
                    "description": "(optional) Terraform state bucket region can be specified here. Normally AWS_REGION is used here. Can be overridden via env vars or flags."
                },
                "state_bucket_name" : {
                    "type": "string",
                    "description": "(optional) Terraform state bucket name can be specified here. Normally it's generated and defaults to <NAMESPACE>-tf-state"
                },
                "state_name": {
                    "type": "string",
                    "description": "(optional) Terraform state name that will be used in the .tfstate file. Normally it's 'terraform' or state name."
                },
                "root_domain_name"   : {
                    "type": "string",
                    "description": "(optional) Root domain name can be set here. This is the main domain that will be passed to the terraform. Generally if your app lives at 'api.dev.nutcorp.net' the root domain is `nutcorp.net`"
                },
                "aws_region"   : {
                    "type": "string",
                    "description": "(optional) Terraform-specific AWS Region of this environment should be specified here. Normally global AWS_REGION is used."
                },
                "aws_profile"  : {
                    "type": "string",
                    "description": "(optional) Terraform-specific AWS profile (optional) can be specified here (but normally it should be inherited from a global AWS_PROFILE)."
                }
            },
            "description": "Terraform configuration",
            "additionalProperties": false
        }
    },
    "required": [
        "env",
        "aws_profile",
        "aws_region",
        "namespace",
        "env_dir",
        "home",
        "ize_dir",
        "prefer_runtime",
        "root_dir"
    ],
    "additionalProperties": false
}