{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://quickiso.app/data-portability/tables/improvements.schema.json",
  "title": "tables/improvements.json",
  "description": "The rows of the table improvements that belong to the workspace, one object per row, keyed by the database's column names.",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "organization_id": {
        "type": "string",
        "format": "uuid"
      },
      "title": {
        "type": "string"
      },
      "description": {
        "type": "string"
      },
      "source": {
        "type": "string",
        "enum": [
          "measurement",
          "internal_audit",
          "nonconformity",
          "management_review",
          "risk",
          "feedback",
          "other"
        ]
      },
      "source_ref": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "status": {
        "type": "string",
        "enum": [
          "proposed",
          "planned",
          "implemented",
          "closed",
          "declined"
        ]
      },
      "raised_on": {
        "type": "string",
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "change": {
        "type": [
          "string",
          "null"
        ]
      },
      "owner_membership_id": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "due_on": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "implemented_on": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "reviewed_on": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "outcome": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "improved",
          "no_change",
          "worse",
          null
        ]
      },
      "review_note": {
        "type": [
          "string",
          "null"
        ]
      },
      "reviewed_by": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "decline_reason": {
        "type": [
          "string",
          "null"
        ]
      },
      "measure_name": {
        "type": [
          "string",
          "null"
        ]
      },
      "measure_unit": {
        "type": [
          "string",
          "null"
        ]
      },
      "baseline_value": {
        "type": [
          "number",
          "null"
        ]
      },
      "baseline_on": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "result_value": {
        "type": [
          "number",
          "null"
        ]
      },
      "result_on": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "created_by": {
        "type": "string",
        "format": "uuid"
      },
      "created_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "revision": {
        "type": "integer"
      }
    },
    "required": [
      "id",
      "organization_id",
      "title",
      "description",
      "source",
      "source_ref",
      "status",
      "raised_on",
      "change",
      "owner_membership_id",
      "due_on",
      "implemented_on",
      "reviewed_on",
      "outcome",
      "review_note",
      "reviewed_by",
      "decline_reason",
      "measure_name",
      "measure_unit",
      "baseline_value",
      "baseline_on",
      "result_value",
      "result_on",
      "created_by",
      "created_at",
      "updated_at",
      "revision"
    ],
    "additionalProperties": false
  }
}
