{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/winnr-app/json-schema/winnr-app-send-email-request-schema.json",
  "title": "SendEmailRequest",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/winnr-app-openapi.yaml#/components/schemas/SendEmailRequest",
  "type": "object",
  "required": [
    "to",
    "subject"
  ],
  "properties": {
    "to": {
      "type": "string",
      "format": "email"
    },
    "subject": {
      "type": "string"
    },
    "body": {
      "type": "string"
    },
    "cc": {
      "type": "string"
    },
    "bcc": {
      "type": "string"
    },
    "html": {
      "type": "boolean",
      "default": false
    },
    "attachments": {
      "type": "array",
      "maxItems": 3,
      "items": {
        "type": "object",
        "required": [
          "key",
          "filename",
          "content_type"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "The `key` returned by `POST /v1/upload/presign`. Single use — the\nstored file is deleted after a successful send.\n"
          },
          "filename": {
            "type": "string"
          },
          "content_type": {
            "type": "string"
          }
        }
      },
      "description": "File attachments (max 3)"
    },
    "in_reply_to": {
      "type": "string",
      "description": "Message-ID of the email being replied to (for threading)"
    },
    "references": {
      "type": "string",
      "description": "Space-separated Message-IDs for the thread (RFC 2822)"
    },
    "calendar_invite": {
      "type": "object",
      "description": "Attach a real calendar invite. We generate the iCalendar document server-side and place it as a text/calendar part with the method parameter, so Gmail and Outlook render their native invite / RSVP card rather than a file to download. ORGANIZER is set to the sending mailbox and ATTENDEE to the recipient automatically. No upload or presign step is involved.\n",
      "required": [
        "summary",
        "start"
      ],
      "properties": {
        "summary": {
          "type": "string",
          "maxLength": 255,
          "description": "Event title shown in the calendar"
        },
        "start": {
          "type": "string",
          "description": "ISO-8601 start. Either carries a UTC offset (2026-08-12T15:00:00Z / 2026-08-12T15:00:00+02:00), or is naive and accompanied by `timezone`.\n"
        },
        "end": {
          "type": "string",
          "description": "ISO-8601 end. Required unless duration_minutes is given."
        },
        "duration_minutes": {
          "type": "integer",
          "minimum": 1,
          "description": "Alternative to `end`."
        },
        "timezone": {
          "type": "string",
          "description": "IANA timezone, required only when start/end have no UTC offset.\n"
        },
        "location": {
          "type": "string",
          "description": "Physical address or a join URL"
        },
        "description": {
          "type": "string"
        },
        "method": {
          "type": "string",
          "enum": [
            "REQUEST",
            "CANCEL",
            "PUBLISH"
          ],
          "default": "REQUEST",
          "description": "REQUEST sends an invitation with RSVP buttons. PUBLISH is add-to-calendar only, with no RSVP and no attendee tracking. CANCEL withdraws a previously sent invite; it must reuse the original `uid` with a higher `sequence`.\n"
        },
        "uid": {
          "type": "string",
          "description": "Omit on first send and store the `calendar_uid` we return. To reschedule or cancel that same event, send the SAME uid with a higher `sequence` — a new uid creates a second, unrelated event in the recipient's calendar instead of updating the first.\n"
        },
        "sequence": {
          "type": "integer",
          "minimum": 0,
          "default": 0,
          "description": "Increment on every update or cancellation of the same uid."
        }
      }
    }
  }
}