class BookingMessageTO {

    public String toJson() {
        try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
            new BookingMessageTOWriter().writeTo(this, null, null, null, MediaType.APPLICATION_JSON_TYPE, null, bos);
            bos.flush();
            return bos.toString(StandardCharsets.UTF_8.name());
        } catch (IOException e) {
            throw new RuntimeException("Cannot convert " + this + " to JSON", e);
        }


//        StringWriter sw = new StringWriter();
//        JsonGenerator generator = Json.createGenerator(sw);
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//        generator.writeStartObject()
//                .write("guestId", this.guest)
//                .write("roomNumber", this.room)
//                .write("checkin", formatter.format(this.checkin))
//                .write("checkout", formatter.format(this.checkout))
//                .writeEnd()
//                .close();
//        return sw.toString();
    }

    public  BookingMessageTO(Long guest, String room, LocalDate checkin, LocalDate checkout);

}