{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://seedtactics.com/schemas/orders",
  "title": "SeedTactic Order JSON",
  "type": "object",
  "oneOf": [
    {
      "$ref": "#/$defs/LoadOrderResponse"
    }
  ],
  "$defs": {
    "ScheduledPartWithoutBooking": {
      "type": "object",
      "required": ["Part", "Quantity"],
      "properties": {
        "Part": {
          "type": "string"
        },
        "Quantity": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "Booking": {
      "type": "object",
      "required": ["BookingId", "DueDate", "Priority", "Parts"],
      "properties": {
        "BookingId": {
          "type": "string"
        },
        "DueDate": {
          "type": "string",
          "format": "date-time"
        },
        "Priority": {
          "type": "integer",
          "format": "int32"
        },
        "Parts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BookingDemand"
          }
        }
      }
    },
    "BookingDemand": {
      "type": "object",
      "required": ["Part", "Quantity"],
      "properties": {
        "Part": {
          "type": "string"
        },
        "Quantity": {
          "type": "integer",
          "format": "int32"
        },
        "PathColors": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "NewSchedule": {
      "type": "object",
      "required": [
        "ScheduleId",
        "ScheduledTimeUTC",
        "ScheduledHorizon",
        "BookingIds",
        "DownloadedParts",
        "ScheduledParts"
      ],
      "properties": {
        "ScheduleId": {
          "type": "string"
        },
        "ScheduledTimeUTC": {
          "type": "string",
          "format": "date-time"
        },
        "ScheduledHorizon": {
          "type": "string",
          "format": "time-span"
        },
        "BookingIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "DownloadedParts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DownloadedPart"
          }
        },
        "ScheduledParts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ScheduledPartWithoutBooking"
          }
        }
      }
    },
    "DownloadedPart": {
      "type": "object",
      "required": ["ScheduleId", "Part", "Quantity"],
      "properties": {
        "ScheduleId": {
          "type": "string"
        },
        "Part": {
          "type": "string"
        },
        "Quantity": {
          "type": "integer",
          "format": "int32"
        }
      }
    }
  }
}