{
  "$id": "https://intentschema.org/intents/communication/email/message/move/v1.json",
  "fqdn": "org.intentschema.communication.email.message.move.v1",
  "title": "Move email message",
  "description": "Moves an email message to a different folder (IMAP/Outlook) or changes its label set (Gmail).",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target",
      "object"
    ],
    "properties": {
      "target": {
        "allOf": [
          {
            "$ref": "https://intentschema.org/common/target/v1.json"
          },
          {
            "required": [
              "external_id"
            ]
          }
        ]
      },
      "object": {
        "type": "object",
        "properties": {
          "destination": {
            "type": "string",
            "description": "Provider-specific folder identifier or label. Service profiles refine this (e.g., Gmail labelIds, Outlook folderId)."
          },
          "add_labels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "remove_labels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "idempotency_key": {
        "type": "string"
      }
    }
  },
  "result": {
    "type": "object",
    "properties": {
      "external_id": {
        "type": "string"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  },
  "examples": [
    {
      "name": "Gmail label add/remove",
      "value": {
        "target": {
          "system": "gmail",
          "external_id": "msg_abc123"
        },
        "object": {
          "add_labels": [
            "Label_5"
          ],
          "remove_labels": [
            "INBOX"
          ]
        }
      }
    },
    {
      "name": "Outlook folder move",
      "value": {
        "target": {
          "system": "ms_graph",
          "external_id": "AAMk..."
        },
        "object": {
          "destination": "archive"
        }
      }
    }
  ]
}
