@Override
    public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
        for(Path f : files.keySet()) {
            if(f.isPlaceholder()) {
                log.warn(String.format("Ignore placeholder %s", f));
                continue;
            }
            try {
                if(new SimplePathPredicate(DriveHomeFinderService.SHARED_DRIVES_NAME).test(f.getParent())) {
                    session.getClient().teamdrives().delete(fileid.getFileId(f)).execute();
                }
                else {
                    if(f.attributes().isHidden()) {
                        log.warn(String.format("Delete file %s already in trash", f));
                        new DriveDeleteFeature(session, fileid).delete(Collections.singletonList(f), prompt, callback);
                        continue;
                    }
                    callback.delete(f);
                    final File properties = new File();
                    properties.setTrashed(true);
                    session.getClient().files().update(fileid.getFileId(f), properties)
                            .setSupportsAllDrives(new HostPreferences(session.getHost()).getBoolean("googledrive.teamdrive.enable")).execute();
                }
                fileid.cache(f, null);
            }
            catch(IOException e) {
                throw new DriveExceptionMappingService(fileid).map("Cannot delete {0}", e, f);
            }
        }
    }
@Test
    public void testDeleteFromTrash() throws Exception {
        final DriveFileIdProvider fileid = new DriveFileIdProvider(session);
        final Path file = new DriveTouchFeature(session, fileid).touch(
                new Path(DriveHomeFinderService.MYDRIVE_FOLDER, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        final String fileId = file.attributes().getFileId();
        new DriveTrashFeature(session, fileid).delete(Collections.singletonList(file), new DisabledPasswordCallback(), new Delete.DisabledCallback());
        assertFalse(new DriveFindFeature(session, fileid).find(file));
        assertTrue(new DriveFindFeature(session, fileid).find(file.withAttributes(new PathAttributes().withFileId(fileId))));
        final PathAttributes attributesInTrash = new DriveAttributesFinderFeature(session, fileid).find(file.withAttributes(new PathAttributes().withFileId(fileId)));
        assertTrue(attributesInTrash.isHidden());
        new DriveTrashFeature(session, fileid).delete(Collections.singletonList(file.withAttributes(attributesInTrash)), new DisabledPasswordCallback(), new Delete.DisabledCallback());
        assertFalse(new DriveFindFeature(session, fileid).find(file.withAttributes(attributesInTrash)));
    }