class JobQueueBatch implements Serializable {

    public Optional<String> fetchNextPatient(UUID aggregatorID) {
        if (this.status != JobStatus.RUNNING) {
            throw new JobQueueFailure(jobID, batchID, String.format("Cannot fetch next batch. JobStatus: %s", this.status));
        }
        this.verifyAggregatorID(aggregatorID);
        this.setUpdateTime();
        int index = this.getPatientIndex().orElse(-1) + 1;
        if (index < this.patients.size()) {
            // Patient index should be set to the last successful fetched result
            this.patientIndex = index;
            return Optional.of(this.patients.get(this.patientIndex));
        }
        return Optional.empty();
    }

    public  JobQueueBatch();
    public  JobQueueBatch(UUID jobID,
                         UUID orgID,
                         String providerID,
                         List<String> patients,
                         List<ResourceType> resourceTypes,
                         OffsetDateTime since,
                         OffsetDateTime transactionTime);

}