{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thesignup-app/json-schema/thesignup-app-cancel-day-response-schema.json",
  "title": "CancelDayResponse",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/thesignup-app-openapi.json#/components/schemas/CancelDayResponse",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "day"
          ]
        },
        "day": {
          "$ref": "#/$defs/Day"
        },
        "affectedSignups": {
          "type": "integer",
          "description": "Distinct people holding a slot, an item or Day Attendance on the day. Their registrations are kept."
        },
        "audience": {
          "type": "integer",
          "description": "People the cancellation emails, before anyone's notification preferences."
        },
        "confirmed": {
          "type": "boolean",
          "description": "Always `true` from this door: the call executed."
        },
        "notified": {
          "type": "object",
          "properties": {
            "recipients": {
              "type": "integer"
            },
            "emails": {
              "type": "integer"
            },
            "sms": {
              "type": "integer"
            }
          },
          "required": [
            "recipients",
            "emails",
            "sms"
          ],
          "description": "Who was told: distinct people, emails sent, texts sent. All zero on a repeat cancel."
        }
      },
      "required": [
        "kind",
        "day",
        "affectedSignups",
        "audience",
        "confirmed",
        "notified"
      ]
    },
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "series_date"
          ]
        },
        "cancelled": {
          "type": "integer",
          "description": "Live Shifts on the date that were cancelled. 0 when it was already off, or when only a one-off slot was live and the day itself was called off (see `dayCancelledAt`)."
        },
        "dayCancelledAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When this call called the day off (the day's `cancelledAt`, shared by the Shifts it cancelled), or null when the day was already off or nothing on it was live. A one-off slot on the day is off through this stamp."
        },
        "affectedParticipants": {
          "type": "integer",
          "description": "Registrations on the cancelled Shifts (rows, not people). They are kept."
        },
        "notified": {
          "type": "object",
          "properties": {
            "recipients": {
              "type": "integer"
            },
            "emails": {
              "type": "integer"
            },
            "sms": {
              "type": "integer"
            }
          },
          "required": [
            "recipients",
            "emails",
            "sms"
          ],
          "description": "Who was told: distinct people, emails sent, texts sent."
        }
      },
      "required": [
        "kind",
        "cancelled",
        "dayCancelledAt",
        "affectedParticipants",
        "notified"
      ]
    }
  ],
  "$defs": {
    "Day": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "eventId": {
          "type": "string",
          "format": "uuid"
        },
        "date": {
          "type": "string",
          "description": "The calendar date, `YYYY-MM-DD`, in the signup's timezone."
        },
        "seriesId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The Slot Series that generated this day, or null for a day added by hand or an ordinary signup's day."
        },
        "cancelledAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When the day was called off, or null. A cancelled day keeps its slots, items and registrations. A repeating schedule's date is cancelled through its Shifts instead and keeps null here; read `noLiveTime`."
        },
        "noLiveTime": {
          "type": "boolean",
          "description": "True when the day had times and none of them is live any more — participants are not offered it, exactly as a cancelled day."
        },
        "question": {
          "allOf": [
            {
              "$ref": "#/$defs/Question"
            },
            {
              "type": [
                "object",
                "null"
              ],
              "description": "The Day Question asked once per day of whoever signs up for anything that day: the day's own, else the repeating schedule's default. Null when none."
            }
          ]
        },
        "questionSource": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "own",
            "series",
            null
          ],
          "description": "Whose `question` it is: the day's own, or the schedule's default it inherits. Null when there is no question."
        },
        "isPast": {
          "type": "boolean",
          "description": "Whether the date is before today in the signup's timezone."
        }
      },
      "required": [
        "id",
        "eventId",
        "date",
        "seriesId",
        "cancelledAt",
        "noLiveTime",
        "question",
        "questionSource",
        "isPast"
      ]
    },
    "Question": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "placeholder": {
          "type": "string",
          "description": "Example answer, shown as a hint in the answer box. Absent when none was given."
        },
        "required": {
          "type": "boolean"
        }
      },
      "required": [
        "label",
        "required"
      ]
    }
  }
}