{
  "$id": "https://matchi.com/schemas/json/BookingCancelledV2.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "BookingCancelledV2",
  "description": "A message that is sent when a booking is cancelled (v2). In addition to the v1 fields it carries the booking type, the underlying entity ID and the activity detail, and is emitted for standard court, activity, subscription and training bookings. This is the data part of the message; please read the event section for more information on the metadata envelope.",
  "type": "object",
  "required": [
    "booking",
    "owner",
    "players",
    "facility"
  ],
  "properties": {
    "owner": {
      "type": "object",
      "required": [
        "customerId"
      ],
      "title": "Owner",
      "description": "Booking owner information",
      "properties": {
        "customerId": {
          "type": "string",
          "title": "Customer ID",
          "description": "A unique identifier for the customer."
        },
        "userId": {
          "type": "string",
          "format": "uuid",
          "title": "User ID",
          "description": "A unique identifier for the user, in UUID format."
        },
        "firstName": {
          "type": "string",
          "title": "First Name",
          "description": "The first name of the booking owner."
        },
        "lastName": {
          "type": "string",
          "title": "Last Name",
          "description": "The last name of the booking owner."
        },
        "email": {
          "type": "string",
          "format": "email",
          "title": "Email",
          "description": "The email address of the booking owner, in a valid email format."
        },
        "address": {
          "type": "string",
          "title": "Address",
          "description": "The street address of the booking owner."
        },
        "city": {
          "type": "string",
          "title": "City",
          "description": "The city where the booking owner resides."
        },
        "zipcode": {
          "type": "string",
          "title": "Zipcode",
          "description": "The postal code of the booking owner's address."
        },
        "country": {
          "type": "string",
          "title": "Country",
          "description": "The country where the booking owner resides."
        },
        "nationality": {
          "type": "string",
          "title": "Nationality",
          "description": "The nationality of the booking owner."
        },
        "cellphone": {
          "type": "string",
          "title": "Cellphone",
          "description": "The cellphone number of the booking owner."
        },
        "telephone": {
          "type": "string",
          "title": "Telephone",
          "description": "The telephone number of the booking owner."
        },
        "dateOfBirth": {
          "type": "string",
          "format": "date",
          "title": "Date of Birth",
          "description": "The date of birth of the booking owner, in YYYY-MM-DD format."
        },
        "gender": {
          "type": "string",
          "title": "Gender",
          "description": "The gender of the booking owner."
        },
        "isOrganization": {
          "type": "boolean",
          "title": "Is Organization",
          "description": "Indicates whether the booking owner is an organization."
        },
        "doNotEmail": {
          "type": "boolean",
          "title": "Do Not Email",
          "description": "Indicates whether the booking owner should not receive emails from facility."
        },
        "registrationDate": {
          "type": "string",
          "format": "date-time",
          "title": "Registration Date",
          "description": "The date and time when the booking owner registered, in ISO 8601 format."
        }
      },
      "examples": [
        {
          "customerId": "CUST123456",
          "userId": "550e8400-e29b-41d4-a716-446655440000",
          "firstName": "John",
          "lastName": "Doe",
          "email": "john.doe@example.com",
          "address": "123 Main St",
          "city": "Anytown",
          "zipcode": "12345",
          "country": "USA",
          "nationality": "American",
          "cellphone": "+1234567890",
          "telephone": "+0987654321",
          "dateOfBirth": "1980-01-01",
          "gender": "Male",
          "isOrganization": false,
          "doNotEmail": false,
          "registrationDate": "2023-07-04T10:00:00Z"
        }
      ]
    },
    "booking": {
      "title": "BookingV2",
      "type": "object",
      "required": [
        "bookingId",
        "startTime",
        "endTime",
        "courtId",
        "courtName",
        "bookingType"
      ],
      "properties": {
        "bookingId": {
          "type": "string",
          "title": "Booking ID",
          "description": "A unique identifier for the booking."
        },
        "bookingType": {
          "type": "string",
          "enum": [
            "DEFAULT",
            "ACTIVITY",
            "SUBSCRIPTION",
            "TRAINING"
          ],
          "title": "Booking Type",
          "description": "The kind of booking. DEFAULT is a standard court booking; ACTIVITY, SUBSCRIPTION and TRAINING are customer-facing booking types that v1 did not emit."
        },
        "entityId": {
          "type": "string",
          "title": "Entity ID",
          "description": "ID of the underlying entity the booking belongs to. Set for ACTIVITY/TRAINING (the activity ID) and SUBSCRIPTION (the subscription ID); absent for DEFAULT court bookings, which are identified by bookingId."
        },
        "activityDetail": {
          "type": "string",
          "enum": [
            "TOURNAMENT",
            "OPEN_MATCH",
            "CLASS",
            "EVENT",
            "COURSE"
          ],
          "title": "Activity Detail",
          "description": "Customer-facing classification of the underlying activity, present only when bookingType is ACTIVITY or TRAINING."
        },
        "startTime": {
          "type": "string",
          "format": "date-time",
          "title": "Start Time",
          "description": "The start time of the booking, in ISO 8601 format."
        },
        "endTime": {
          "type": "string",
          "format": "date-time",
          "title": "End Time",
          "description": "The end time of the booking, in ISO 8601 format."
        },
        "courtId": {
          "type": "string",
          "title": "Court ID",
          "description": "A unique identifier for the court."
        },
        "courtName": {
          "type": "string",
          "title": "Court Name",
          "description": "The name of the court."
        },
        "accessCode": {
          "type": "string",
          "title": "Access Code",
          "description": "A code to access the court."
        },
        "splitPayment": {
          "type": "boolean",
          "title": "Split Payment",
          "description": "Indicates whether the booking type is a split payment booking."
        },
        "internalNotes": {
          "type": "string",
          "title": "Internal Notes",
          "description": "The comments/notes on the booking which should be hidden from players."
        },
        "externalNotes": {
          "type": "string",
          "title": "External Notes",
          "description": "The comments/notes on the booking which should be shown to players."
        },
        "externalPayment": {
          "type": "boolean",
          "title": "External Payment",
          "description": "Indicates whether the booking requires an external provider payment (f.ex: TPC payment gateway)."
        },
        "totalPrice": {
          "type": "string",
          "title": "Total Price",
          "description": "The total price paid for the booking, including VAT. Adjusted to exclude discounts."
        }
      },
      "examples": [
        {
          "bookingId": "1234555",
          "bookingType": "ACTIVITY",
          "entityId": "4711",
          "activityDetail": "OPEN_MATCH",
          "startTime": "2024-07-04T10:00:00Z",
          "endTime": "2024-07-04T11:00:00Z",
          "courtId": "C001",
          "courtName": "Main Court",
          "accessCode": "ACCESS1234",
          "splitPayment": true,
          "internalNotes": "This note is hidden from customers",
          "externalNotes": "9025 Vuxenkurs",
          "externalPayment": false,
          "totalPrice": "1000.00"
        }
      ]
    },
    "players": {
      "title": "Players",
      "description": "List of players",
      "type": "array",
      "items": {
        "title": "Player",
        "description": "Player information",
        "type": "object",
        "required": [
          "isCustomer"
        ],
        "properties": {
          "customerId": {
            "type": "string",
            "title": "Customer ID",
            "description": "A unique identifier for the customer."
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "title": "User ID",
            "description": "A unique identifier for the player, in UUID format."
          },
          "firstName": {
            "type": "string",
            "title": "First Name",
            "description": "The first name of the player."
          },
          "lastName": {
            "type": "string",
            "title": "Last Name",
            "description": "The last name of the player."
          },
          "cellphone": {
            "type": "string",
            "title": "Cellphone",
            "description": "The cellphone number of the player."
          },
          "telephone": {
            "type": "string",
            "title": "Telephone",
            "description": "The telephone number of the player."
          },
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email",
            "description": "The email address of the player, in a valid email format."
          },
          "isCustomer": {
            "type": "boolean",
            "title": "Is Customer",
            "description": "Indicates whether the player is a customer."
          }
        },
        "examples": [
          {
            "userId": "550e8400-e29b-41d4-a716-446655440000",
            "email": "john.doe@example.com",
            "isCustomer": false,
            "telephone": "1234567890",
            "cellphone": "0987654321",
            "firstName": "John",
            "lastName": "Doe",
            "customerId": "123456"
          }
        ]
      }
    },
    "facility": {
      "title": "Facility",
      "description": "Facility information",
      "type": "object",
      "required": [
        "facilityId",
        "facilityName"
      ],
      "properties": {
        "facilityId": {
          "type": "string",
          "title": "Facility ID",
          "description": "A unique identifier for the facility."
        },
        "facilityName": {
          "type": "string",
          "title": "Facility Name",
          "description": "The name of the facility."
        }
      },
      "examples": [
        {
          "facilityId": "2344123",
          "facilityName": "Matchi Tennis Club"
        }
      ]
    }
  }
}