class ImmutableAcknowledgements implements Acknowledgements {

    @Override
    public Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion) {
        final int acknowledgementsSize = acknowledgements.size();
        final Optional<JsonValue> result;
        if (0 == acknowledgementsSize) {
            result = Optional.empty();
        } else if (1 == acknowledgementsSize) {
            final Acknowledgement soleAcknowledgement = acknowledgements.get(0);
            result = soleAcknowledgement.getEntity(schemaVersion);
        } else {
            result = Optional.of(acknowledgementsEntitiesToJson(schemaVersion));
        }
        return result;
    }

    private  ImmutableAcknowledgements(final EntityIdWithType entityId,
            final Collection<? extends Acknowledgement> acknowledgements,
            final HttpStatusCode statusCode,
            final DittoHeaders dittoHeaders);

}