{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/phrase.json",
  "definitions": {
    "project_id": {
      "description": "ID of the project",
      "type": "string"
    },
    "file_format": {
      "description": "File format name. See the format guide in the documentation for all supported file formats",
      "type": "string",
      "default": "yml"
    },
    "locale_id": {
      "description": "Locale that should be downloaded. Locale ID or locale name are valid options",
      "type": "string"
    },
    "encoding": {
      "description": "Enforces a specific encoding on the file contents. Valid options are \"UTF-8\", \"UTF-16\" and \"ISO-8859-1\"",
      "type": "string",
      "default": "UTF-8"
    },
    "format_options": {
      "description": "Additional options available for specific formats. See our format guide for complete list.",
      "type": "object",
      "properties": {
        "column_separator": {
          "description": "Column separator character",
          "type": "string",
          "default": ";"
        }
      }
    }
  },
  "properties": {
    "phrase": {
      "description": "Root element of the Phrase config",
      "type": "object",
      "properties": {
        "host": {
          "description": "API URL. Set to https://api.us.app.phrase.com/v2 when using the US datacenter",
          "type": "string"
        },
        "access_token": {
          "description": "Access Token for authorization. Can be created in the user profile",
          "type": "string"
        },
        "file_format": {
          "$ref": "#/definitions/file_format"
        },
        "project_id": {
          "$ref": "#/definitions/project_id"
        },
        "push": {
          "type": "object",
          "properties": {
            "sources": {
              "description": "Source files that will be uploaded on push",
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "file": {
                    "description": "Translation file(s) which should be uploaded. You can either specify a single file or a pattern. The glob pattern will be expanded to all files matching the pattern. Besides '*' and '**', you can use the following placeholders: <locale_name> for the locale name and <locale_code> for the locale code",
                    "type": "string",
                    "examples": [
                      "en.yml",
                      "translations/*.yml",
                      "./src/<locale_name>.yml"
                    ]
                  },
                  "params": {
                    "description": "Locale upload parameter",
                    "type": "object",
                    "properties": {
                      "file_format": {
                        "$ref": "#/definitions/file_format"
                      },
                      "locale_id": {
                        "$ref": "#/definitions/locale_id"
                      },
                      "branch": {
                        "description": "Branch name",
                        "type": "string"
                      },
                      "tags": {
                        "description": "List of tags separated by comma to be associated with the new keys contained in the upload",
                        "type": "string"
                      },
                      "update_translations": {
                        "description": "Indicates whether existing translations should be updated with the file content",
                        "type": "boolean",
                        "default": false
                      },
                      "update_descriptions": {
                        "description": "Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions",
                        "type": "boolean",
                        "default": false
                      },
                      "convert_emoji": {
                        "description": "Indicates whether the file contains Emoji symbols that should be converted",
                        "type": "boolean",
                        "deprecated": "Emojis are now supported natively",
                        "default": false
                      },
                      "skip_upload_tags": {
                        "description": "Indicates whether the upload should not create upload tags",
                        "type": "boolean",
                        "default": false
                      },
                      "skip_unverification": {
                        "description": "Indicates whether the upload should unverify updated translations",
                        "type": "boolean",
                        "default": false
                      },
                      "tag_only_affected_keys": {
                        "description": "Indicates whether only keys affected (created or updated) by the upload should be tagged",
                        "type": "boolean",
                        "default": false
                      },
                      "autotranslate": {
                        "description": "If set, translations for the uploaded language will be fetched automatically",
                        "type": "boolean",
                        "default": false
                      },
                      "mark_reviewed": {
                        "description": "Indicates whether the imported translations should be marked as reviewed",
                        "type": "boolean",
                        "default": false
                      },
                      "file_encoding": {
                        "$ref": "#/definitions/encoding"
                      },
                      "translation_key_prefix": {
                        "description": "Prefix all the created keys with the given prefix. This can be used to prevent collisions from multiple different sources",
                        "type": "string"
                      },
                      "locale_mapping": {
                        "description": "Optional, format specific mapping between locale names and the columns the translations to those locales are contained in",
                        "type": "object"
                      },
                      "format_options": {
                        "$ref": "#/definitions/format_options"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "pull": {
          "type": "object",
          "properties": {
            "targets": {
              "description": "List of files that will be downloaded on pull",
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "file": {
                    "description": "Translation file which will be downloaded. You can either specify a single file or a pattern. The pattern can contain the following placeholders: <locale_name> for the locale name, <locale_code> for the locale code, and <tag>, which will go through the tag list and create a file for each tag. The placeholders will be replaced with the corresponding values.",
                    "type": "string",
                    "examples": ["en.yml", "translations/<locale_name>.yml"]
                  },
                  "project_id": {
                    "$ref": "#/definitions/project_id"
                  },
                  "params": {
                    "description": "Locale download parameter",
                    "type": "object",
                    "properties": {
                      "branch": {
                        "description": "Branch name",
                        "type": "string"
                      },
                      "file_format": {
                        "$ref": "#/definitions/file_format"
                      },
                      "tags": {
                        "description": "Limit results to keys tagged with a list of comma separated tag names",
                        "type": "string",
                        "default": ""
                      },
                      "locale_id": {
                        "$ref": "#/definitions/locale_id"
                      },
                      "locale_ids": {
                        "description": "List of locale IDs to be downloaded.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "include_empty_translations": {
                        "description": "Indicates whether keys without translations should be included in the output as well",
                        "type": "boolean",
                        "default": false
                      },
                      "exclude_empty_zero_forms": {
                        "description": "Indicates whether the upload should exclude empty zero forms",
                        "type": "boolean",
                        "default": false
                      },
                      "include_translated_keys": {
                        "description": "Include translated keys in the locale file. Use in combination with include_empty_translations to obtain only untranslated keys",
                        "type": "boolean",
                        "default": true
                      },
                      "keep_notranslate_tags": {
                        "description": "Indicates whether [NOTRANSLATE] tags should be kept",
                        "type": "boolean",
                        "default": false
                      },
                      "include_unverified_translations": {
                        "description": "Indicates whether unverified translations should be included in the locale file",
                        "type": "boolean",
                        "default": true
                      },
                      "convert_emoji": {
                        "description": "Indicates whether Emoji symbols should be converted to actual Emojis",
                        "type": "boolean",
                        "deprecated": "Emojis are now supported natively",
                        "default": false
                      },
                      "encoding": {
                        "$ref": "#/definitions/encoding"
                      },
                      "skip_unverified_translations": {
                        "description": "Indicates whether the locale file should skip all unverified translations",
                        "type": "boolean",
                        "deprecated": "Should be replaced with include_unverified_translations",
                        "default": false
                      },
                      "use_last_reviewed_version": {
                        "description": "If set to true the last reviewed version of a translation is used. This is only available if the review workflow is enabled for the project",
                        "type": "boolean",
                        "default": false
                      },
                      "fallback_locale_id": {
                        "description": "If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the public ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to true. Mutually exclusive with use_locale_fallback",
                        "type": "string"
                      },
                      "use_locale_fallback": {
                        "description": "If set to true the locale fallback (set in the locale's settings) will be used to fetch missing translations. Requires include_empty_translations to be set to true. Mutually exclusive with fallback_locale_id",
                        "type": "boolean",
                        "default": false
                      },
                      "custom_metadata_filters": {
                        "description": "Custom metadata filters. Provide the name of the metadata field and the value to filter by. Only keys with matching metadata will be included in the download",
                        "type": "object"
                      },
                      "filter_by_prefix": {
                        "description": "Filters keys by prefix. Only keys starting with the given prefix will be included in the download, and the prefix will be removed from the key name in the files",
                        "type": "string"
                      },
                      "translation_key_prefix": {
                        "description": "If a key name starts with the given prefix, the prefix will be removed from the key name in the files",
                        "type": "string"
                      },
                      "updated_since": {
                        "description": "Only keys updated since the given date (in ISO 8601 format) will be included in the download",
                        "type": "string",
                        "format": "date-time"
                      },
                      "format_options": {
                        "$ref": "#/definitions/format_options"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "title": "JSON schema for Phrase configuration files"
}
