@Delete(uri = "{namespace}/{id}")
    @ExecuteOn(TaskExecutors.IO)
    @Operation(tags = {"Flows"}, summary = "Delete a flow")
    @ApiResponse(responseCode = "204", description = "On success")
    public HttpResponse<Void> delete(
        @Parameter(description = "The flow namespace") @PathVariable String namespace,
        @Parameter(description = "The flow id") @PathVariable String id
    ) {
        Optional<Flow> flow = flowRepository.findById(tenantService.resolveTenant(), namespace, id);
        if (flow.isPresent()) {
            flowRepository.delete(flow.get());
            return HttpResponse.status(HttpStatus.NO_CONTENT);
        } else {
            return HttpResponse.status(HttpStatus.NOT_FOUND);
        }
    }
@Test
    void deleteFlowsByQuery(){
        postFlow("flow-a","io.kestra.tests.delete", "a");
        postFlow("flow-b","io.kestra.tests.delete", "b");
        postFlow("flow-c","io.kestra.tests.delete", "c");

        List<IdWithNamespace> ids = List.of(
            new IdWithNamespace("io.kestra.tests.delete", "flow-a"),
            new IdWithNamespace("io.kestra.tests.delete", "flow-b"),
            new IdWithNamespace("io.kestra.tests.delete", "flow-c")
        );

        HttpResponse<BulkResponse> response = client
            .toBlocking()
            .exchange(DELETE("/api/v1/flows/delete/by-ids", ids), BulkResponse.class);

        assertThat(response.getBody().get().getCount(), is(3));

        HttpClientResponseException flowA = assertThrows(HttpClientResponseException.class, () -> {
            client.toBlocking().retrieve(HttpRequest.GET("/api/v1/flows/io.kestra.unittest.disabled/flow-a"));
        });
        HttpClientResponseException flowB = assertThrows(HttpClientResponseException.class, () -> {
            client.toBlocking().retrieve(HttpRequest.GET("/api/v1/flows/io.kestra.unittest.disabled/flow-b"));
        });
        HttpClientResponseException flowC = assertThrows(HttpClientResponseException.class, () -> {
            client.toBlocking().retrieve(HttpRequest.GET("/api/v1/flows/io.kestra.unittest.disabled/flow-c"));
        });

        assertThat(flowA.getStatus(), is(HttpStatus.NOT_FOUND));
        assertThat(flowB.getStatus(), is(HttpStatus.NOT_FOUND));
        assertThat(flowC.getStatus(), is(HttpStatus.NOT_FOUND));
    }