{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/getlabs/json-schema/getlabs-lab-order-details-dto-schema.json",
  "title": "LabOrderDetailsDto",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/getlabs-openapi.yml#/components/schemas/LabOrderDetailsDto",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "readOnly": true,
      "format": "uuid",
      "description": "The ID of this entity"
    },
    "contactName": {
      "type": [
        "string",
        "null"
      ],
      "description": "Name of the person/doctor's office who has the lab order details. Required if labOrderFileIds does NOT include a 'lab-order' file AND the appointment is NOT a priority appointment."
    },
    "contactPhone": {
      "type": [
        "string",
        "null"
      ],
      "description": "10 digit phone number of the person/doctor's office who has the lab order details. Required if labOrderFileIds does NOT include a 'lab-order' file AND the appointment is NOT a priority appointment."
    },
    "labOrderFiles": {
      "readOnly": true,
      "description": "An array of all files attached.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/ExtendedFileDto"
      }
    },
    "testCodes": {
      "description": "An array of test codes to be performed for this lab order.",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "labOrderFileIds": {
      "writeOnly": true,
      "description": "An array of file IDs that were previously uploaded (and returned) using the /file endpoint. Files must have a purpose of 'lab-order' or 'collection-instructions'; a 'collection-instructions' file is only ever an attachment, so at least one 'lab-order' file is still required wherever a lab order is. Required if contactName and contactPhone are not set OR if trying to schedule a priority appointment and/or have already uploaded files using the /file endpoint.",
      "type": "array",
      "items": {
        "type": "string",
        "format": "uuid"
      }
    }
  },
  "$defs": {
    "ExtendedFileDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "readOnly": true,
          "format": "uuid"
        },
        "name": {
          "type": "string",
          "description": "File name"
        },
        "purpose": {
          "description": "The purpose of this file, must be one of the available options",
          "allOf": [
            {
              "$ref": "#/$defs/ExtendedFilePurpose"
            }
          ]
        },
        "data": {
          "type": "string",
          "description": "Base64 encoded file contents, maximum size of 25 MB. The file MIME types allowed differ depending on the file \"purpose\":\n* lab-order can be one of: image/png, image/jpeg, image/heic, image/heif, image/tiff, application/pdf\n* collection-instructions can be one of: image/png, image/jpeg, image/heic, image/heif, image/tiff, application/pdf\n* insurance-front, insurance-rear can be one of: image/png, image/jpeg, image/heic, image/heif, image/tiff, application/pdf",
          "writeOnly": true
        },
        "size": {
          "type": "number",
          "description": "The file size in bytes",
          "readOnly": true
        },
        "type": {
          "type": "string",
          "description": "Type of the file.",
          "readOnly": true
        },
        "url": {
          "type": "string",
          "description": "Signed, expiring url for the file.",
          "readOnly": true
        }
      },
      "required": [
        "name",
        "purpose",
        "data",
        "size",
        "type",
        "url"
      ]
    },
    "ExtendedFilePurpose": {
      "type": "string",
      "enum": [
        "lab-order",
        "collection-instructions",
        "insurance-front",
        "insurance-rear",
        "specimen"
      ],
      "description": "The purpose of this file, must be one of the available options"
    }
  }
}