# For syntax see: https://json-schema.org/understanding-json-schema
$schema: "https://json-schema.org/draft/2020-12/schema"
description: PEtab parameter estimation problem config file schema

properties:

  format_version:
    anyOf:
      - type: string
        #  (corresponding to PEP 440).
        pattern: ^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$
      - type: integer

    description: Version of the PEtab format

  id:
    type: string
    description: |
      Identifier of the PEtab problem.

      This is optional and has no effect on the PEtab problem itself.
    pattern: "^[a-zA-Z_]\\w*$"

  parameter_files:
    type: array
    description: |
      List of PEtab parameter files.

    items:
        type: string
        description: |
          File name (absolute or relative) or URL to a PEtab parameter table.

  model_files:
    type: object
    description: One or multiple models

    # the model ID
    patternProperties:
      "^[a-zA-Z_]\\w*$":
        type: object
        properties:
          location:
            type: string
            description: Model file name or URL
          language:
            type: string
            description: |
              Model language, e.g., 'sbml', 'cellml', 'bngl', 'pysb'
        required:
          - location
          - language
    additionalProperties: false

  measurement_files:
    type: array
    description: List of PEtab measurement files.

    items:
      type: string
      description: PEtab measurement file name or URL.

  condition_files:
    type: array
    description: List of PEtab condition files.

    items:
      type: string
      description: PEtab condition file name or URL.

  experiment_files:
    type: array
    description: List of PEtab experiment files

    items:
      type: string
      description: PEtab experiment file name or URL.

  observable_files:
    type: array
    description: List of PEtab observable files.

    items:
      type: string
      description: PEtab observable file name or URL.

  mapping_files:
    type: array
    description: List of PEtab mapping files.

    items:
      type: string
      description: PEtab mapping file name or URL.

  extensions:
    type: object
    description: |
      PEtab extensions being used.
    patternProperties:
      "^[a-zA-Z][\\-\\w]*$":

        type: object
        description: |
          Information on a specific extension
        properties:
          version:
            type: string
            pattern: ^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$
          required:
            type: boolean
            description: |
              Indicates whether the extension is required for the
              mathematical interpretation of the problem.
        required:
          - version
          - required
      additionalProperties: true

    additionalProperties: false

required:
  - format_version
  - parameter_files
  - model_files
  - observable_files
  - measurement_files

additionalProperties: false
