#%RAML 1.0 Library

uses:
  cti: ../../../.ramlx/cti.raml
  error_lib: ../common/schemas/error.raml
  scalar: ../../../.ramlx/scalar.raml

annotationTypes:
  Dictionaries:
    type: Dictionary[]
    allowedTargets: [Library]

types:
  DictData:
    additionalProperties: false
    properties:
      id:
        type: cti.CTI
        (cti.reference): cti.a.p.presentation.dict.v1.0
        description: Identifier of L10N Dictionary object.
      language: scalar.langCode
      content:
        description: Key-Value pair, where key is an arbitrary string and value is a localized text.
        properties:
          //:
            description: Localized text. May use templates in [pongo2](https://github.com/flosch/pongo2) format.
            type: string
            maxLength: 1024
    examples:
      "en-US": !include ./assets/dictionaries/en-US.yaml
      "es-ES": !include ./assets/dictionaries/es-ES.yaml
      "pt-BR": !include ./assets/dictionaries/pt-BR.yaml

  Dictionary:
    (cti.cti): cti.a.p.presentation.dict.v1.0
    description: Dictionary of localized data

    additionalProperties: false
    properties:
      id:
        type: cti.CTI
        (cti.id): true
        description: CTI identifier of dictionary
      description:
        type: string
        description: Dictionary description/purpose
        (cti.description): true
      data:
        type: object
        description: A map of language codes to dictionary data.
        properties:
          # Key pattern is a copy of scalar.langCode
          /^[a-z]{2}(-[A-Z]{2}|-[A-Z]{1}[a-z]{3})$/: DictData
    example:
      id: cti.a.p.presentation.dict.v1.0~vendor1.app1.dict.v1.0
      description: Vendor1 App1 localization presentation dictionary
      data:
        en-US: !include ./assets/dictionaries/en-US.yaml
        es-ES: !include ./assets/dictionaries/es-ES.yaml
        pt-BR: !include ./assets/dictionaries/pt-BR.yaml
