{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/chartercaptain-com/json-schema/chartercaptain-com-booking-schema.json",
  "title": "Booking",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/chartercaptain-com-openapi.json#/components/schemas/Booking",
  "type": "object",
  "required": [
    "id",
    "captainId",
    "date",
    "status"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "captainId": {
      "type": "string"
    },
    "date": {
      "type": "string",
      "format": "date-time"
    },
    "startTime": {
      "type": [
        "string",
        "null"
      ]
    },
    "endTime": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "PENDING_DEPOSIT",
        "DEPOSIT_PAID",
        "CONFIRMED",
        "COMPLETED",
        "CANCELLED",
        "WEATHER_CANCELLED"
      ]
    },
    "totalPrice": {
      "type": [
        "number",
        "null"
      ]
    },
    "notes": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "customer": {
      "$ref": "#/$defs/Customer"
    },
    "harbor": {
      "$ref": "#/$defs/Harbor"
    },
    "duration": {
      "$ref": "#/$defs/Duration"
    },
    "payments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Payment"
      }
    },
    "weatherChecks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WeatherCheck"
      }
    },
    "notifications": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Notification"
      }
    }
  },
  "$defs": {
    "Customer": {
      "type": "object",
      "required": [
        "id",
        "firstName",
        "lastName",
        "email"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "phone": {
          "type": [
            "string",
            "null"
          ]
        },
        "notes": {
          "type": [
            "string",
            "null"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "Duration": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "hours": {
          "type": "integer"
        },
        "label": {
          "type": "string"
        },
        "isActive": {
          "type": "boolean"
        },
        "sortOrder": {
          "type": "integer"
        }
      },
      "required": [
        "id",
        "hours",
        "label"
      ]
    },
    "Harbor": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "city": {
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "type": [
            "string",
            "null"
          ]
        },
        "lat": {
          "type": [
            "number",
            "null"
          ]
        },
        "lng": {
          "type": [
            "number",
            "null"
          ]
        },
        "sortOrder": {
          "type": "integer"
        },
        "isActive": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "name",
        "isActive"
      ]
    },
    "Notification": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "bookingId": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "sentAt": {
          "type": "string",
          "format": "date-time"
        },
        "status": {
          "type": "string"
        }
      }
    },
    "Payment": {
      "type": "object",
      "required": [
        "id",
        "amount",
        "type",
        "status"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "bookingId": {
          "type": "string"
        },
        "amount": {
          "type": "number"
        },
        "type": {
          "type": "string",
          "enum": [
            "DEPOSIT",
            "BALANCE",
            "TIP",
            "REFUND"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "PENDING",
            "SUCCEEDED",
            "FAILED",
            "REFUNDED"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "WeatherCheck": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "bookingId": {
          "type": "string"
        },
        "checkedAt": {
          "type": "string",
          "format": "date-time"
        },
        "hasAdvisory": {
          "type": "boolean"
        },
        "advisoryType": {
          "type": [
            "string",
            "null"
          ]
        },
        "windSpeed": {
          "type": [
            "number",
            "null"
          ]
        },
        "waveHeight": {
          "type": [
            "number",
            "null"
          ]
        },
        "forecast": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}