{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://getshft.app/schemas/migration-log.schema.json",
  "title": "shft Migration Log",
  "description": "Schema for the JSON payload that shft POSTs to shft.logMigrationsToEndpoint after each migration completes (or fails or is cancelled). The same structure is also written locally to ~/Library/Application Support/shft/logs/migration_<id>.json. Full reference: https://getshft.app/docs/logging.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "sourceSerialNumber",
    "sourceHostname",
    "destinationSerialNumber",
    "destinationHostname",
    "timestampStart",
    "timestampEnd",
    "categoriesTransferred",
    "connectionType",
    "profileApplied",
    "profileIdentifier",
    "overallStatus"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "UUID generated at migration start. Unique per migration."
    },
    "sourceSerialNumber": {
      "type": "string",
      "description": "Hardware serial number of the source Mac, read from IOKit."
    },
    "sourceHostname": {
      "type": "string",
      "description": "Hostname of the source Mac."
    },
    "destinationSerialNumber": {
      "type": "string",
      "description": "Hardware serial number of the destination Mac."
    },
    "destinationHostname": {
      "type": "string",
      "description": "Hostname of the destination Mac."
    },
    "timestampStart": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 UTC timestamp when the user started the transfer."
    },
    "timestampEnd": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 UTC timestamp when the transfer finished (success, failure, or cancel)."
    },
    "categoriesTransferred": {
      "type": "array",
      "description": "One entry per data category that was selected for migration.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["categoryID", "categoryName", "sizeBytes", "filesCount", "status"],
        "properties": {
          "categoryID": {
            "type": "string",
            "enum": [
              "userFiles",
              "applicationData",
              "keychain",
              "systemSettings",
              "browserData"
            ],
            "description": "Machine-readable category identifier."
          },
          "categoryName": {
            "type": "string",
            "description": "Human-readable category name."
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0,
            "description": "Total bytes transferred for this category."
          },
          "filesCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of files transferred in this category."
          },
          "status": {
            "type": "string",
            "enum": ["success", "failed", "skipped", "partial"],
            "description": "success — all files transferred; failed — category-level failure; skipped — user or admin excluded it; partial — some files failed."
          }
        }
      }
    },
    "connectionType": {
      "type": "string",
      "enum": ["wifi", "ethernet", "thunderbolt"],
      "description": "The connection type used."
    },
    "profileApplied": {
      "type": "boolean",
      "description": "true if an MDM configuration profile was detected and applied."
    },
    "profileIdentifier": {
      "type": ["string", "null"],
      "description": "The PayloadIdentifier of the applied profile, or null if none."
    },
    "overallStatus": {
      "type": "string",
      "enum": ["completed", "failed", "cancelled"],
      "description": "completed — migration finished; failed — migration stopped due to error; cancelled — user cancelled."
    }
  }
}
