{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/medsender/json-schema/medsender-email-schema.json",
  "title": "Email",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/medsender-openapi.json#/components/schemas/Email",
  "type": "object",
  "required": [
    "emailId",
    "recipientEmail",
    "emailStatus",
    "recordStatus",
    "isTest",
    "errorDetails"
  ],
  "properties": {
    "emailId": {
      "type": "string"
    },
    "recipientEmail": {
      "type": "string",
      "format": "email"
    },
    "recipientName": {
      "type": [
        "string",
        "null"
      ]
    },
    "senderName": {
      "type": [
        "string",
        "null"
      ]
    },
    "replyToEmail": {
      "anyOf": [
        {
          "type": [
            "string",
            "null"
          ],
          "format": "email"
        },
        {
          "type": "string",
          "const": ""
        }
      ]
    },
    "subject": {
      "type": [
        "string",
        "null"
      ]
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    },
    "patientName": {
      "type": [
        "string",
        "null"
      ]
    },
    "patientDob": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "recordStatus": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "activated",
        "archived",
        "revoked",
        null
      ]
    },
    "emailStatus": {
      "type": "string",
      "enum": [
        "queued",
        "inprogress",
        "success",
        "failure"
      ]
    },
    "secureLink": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "expiry": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "sentAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "lastViewedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "isTest": {
      "type": "boolean"
    },
    "errorDetails": {
      "$ref": "#/$defs/SecureLinkErrorDetails"
    }
  },
  "$defs": {
    "SecureLinkErrorDetails": {
      "type": "object",
      "required": [
        "errorCode",
        "errorDetails"
      ],
      "properties": {
        "errorCode": {
          "type": [
            "string",
            "null"
          ]
        },
        "errorDetails": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}