{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://quickiso.app/data-portability/tables/nonconformities.schema.json",
  "title": "tables/nonconformities.json",
  "description": "The rows of the table nonconformities 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": [
          "internal_audit",
          "external_audit",
          "incident",
          "management_review",
          "complaint",
          "scanner",
          "other"
        ]
      },
      "severity": {
        "type": "string",
        "enum": [
          "minor",
          "major"
        ]
      },
      "status": {
        "type": "string",
        "enum": [
          "open",
          "analysed",
          "corrected",
          "closed"
        ]
      },
      "detected_on": {
        "type": "string",
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "root_cause": {
        "type": [
          "string",
          "null"
        ]
      },
      "correction": {
        "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}$"
      },
      "verified_on": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "effective": {
        "type": [
          "boolean",
          "null"
        ]
      },
      "verification_note": {
        "type": [
          "string",
          "null"
        ]
      },
      "verified_by": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "internal_audit_id": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "source_connector": {
        "type": [
          "string",
          "null"
        ]
      },
      "source_external_id": {
        "type": [
          "string",
          "null"
        ]
      },
      "source_url": {
        "type": [
          "string",
          "null"
        ]
      },
      "source_resource": {
        "type": [
          "string",
          "null"
        ]
      },
      "source_severity": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "critical",
          "high",
          "medium",
          "low",
          "info",
          null
        ]
      },
      "source_state": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "open",
          "resolved",
          "dismissed",
          "gone",
          "handed_over",
          null
        ]
      },
      "source_seen_at": {
        "type": [
          "string",
          "null"
        ],
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "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",
      "severity",
      "status",
      "detected_on",
      "root_cause",
      "correction",
      "owner_membership_id",
      "due_on",
      "verified_on",
      "effective",
      "verification_note",
      "verified_by",
      "internal_audit_id",
      "source_connector",
      "source_external_id",
      "source_url",
      "source_resource",
      "source_severity",
      "source_state",
      "source_seen_at",
      "created_by",
      "created_at",
      "updated_at",
      "revision"
    ],
    "additionalProperties": false
  }
}
