class MetadataMigrationAdminResource {

    @Path(MIGRATION_URI)
    @POST
    @Produces(MediaType.APPLICATION_JSON)
    @VitamAuthentication(authentLevel = AuthenticationLevel.BASIC_AUTHENT)
    public Response startDataMigration() {

        try {

            VitamThreadUtils.getVitamSession().initIfAbsent(VitamConfiguration.getAdminTenant());

            boolean started = this.dataMigrationService.tryStartMongoDataUpdate();

            if (started) {
                LOGGER.info("Migration started successfully");
                return Response.accepted(new ResponseMessage("OK")).build();
            } else {
                LOGGER.warn("Migration already in progress");
                return Response.status(Response.Status.CONFLICT)
                    .entity(new ResponseMessage("Migration already in progress")).build();
            }
        } catch (Exception e) {
            LOGGER.error("An error occurred during data migration", e);
            return Response.serverError().entity(new ResponseMessage(e.getMessage())).build();
        }
    }

    public  MetadataMigrationAdminResource();
    @VisibleForTesting  MetadataMigrationAdminResource(
        DataMigrationService dataMigrationService);

}