class BillingApiHandler extends LoggingRequestHandler {

    private HttpResponse createInvoice(HttpRequest request, String userId) {
        Inspector inspector = inspectorOrThrow(request);
        TenantName tenantName = TenantName.from(getInspectorFieldOrThrow(inspector, "tenant"));

        LocalDate startDate = LocalDate.parse(getInspectorFieldOrThrow(inspector, "startTime"));
        LocalDate endDate = LocalDate.parse(getInspectorFieldOrThrow(inspector, "endTime"));
        ZonedDateTime startTime = startDate.atStartOfDay(ZoneId.of("UTC"));
        ZonedDateTime endTime = endDate.atStartOfDay(ZoneId.of("UTC"));

        var invoiceId = billingController.createInvoiceForPeriod(tenantName, startTime, endTime, userId);

        return new MessageResponse("Created invoice with ID " + invoiceId.value());
    }

    public  BillingApiHandler(Executor executor,
                             AccessLog accessLog,
                             Controller controller);

}