@ExecuteOn(TaskExecutors.IO)
    @Delete(uri = "{namespace}/{id}")
    @Operation(tags = {"Templates"}, summary = "Delete a template")
    @ApiResponse(responseCode = "204", description = "On success")
    public HttpResponse<Void> delete(
        @Parameter(description = "The template namespace") @PathVariable String namespace,
        @Parameter(description = "The template id") @PathVariable String id
    ) {
        Optional<Template> template = templateRepository.findById(tenantService.resolveTenant(), namespace, id);
        if (template.isPresent()) {
            templateRepository.delete(template.get());
            return HttpResponse.status(HttpStatus.NO_CONTENT);
        } else {
            return HttpResponse.status(HttpStatus.NOT_FOUND);
        }
    }
@Test
    void importTemplatesWithZip() throws IOException {
        // create 3 templates, so we have at least 3 of them
        client.toBlocking().retrieve(POST("/api/v1/templates", createTemplate()), Template.class);
        client.toBlocking().retrieve(POST("/api/v1/templates", createTemplate()), Template.class);
        client.toBlocking().retrieve(POST("/api/v1/templates", createTemplate()), Template.class);
        int size = client.toBlocking().retrieve(HttpRequest.GET("/api/v1/templates/search?namespace=kestra.test"), Argument.of(PagedResults.class, Template.class)).getResults().size();

        // extract the created templates
        byte[] zip = client.toBlocking().retrieve(HttpRequest.GET("/api/v1/templates/export/by-query?namespace=kestra.test"),
            Argument.of(byte[].class));
        File temp = File.createTempFile("templates", ".zip");
        Files.write(temp.toPath(), zip);

        // import the templates
        var body = MultipartBody.builder()
            .addPart("fileUpload", "templates.zip", temp)
            .build();
        var response = client.toBlocking().exchange(POST("/api/v1/templates/import", body).contentType(MediaType.MULTIPART_FORM_DATA));

        assertThat(response.getStatus(), is(NO_CONTENT));
        temp.delete();
    }