class AdminOfferSyncResource {

    @Path(OFFER_SYNC_URI)
    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @VitamAuthentication(authentLevel = AuthenticationLevel.BASIC_AUTHENT)
    public Response startSynchronization(OfferSyncRequest offerSyncRequest) {

        ParametersChecker.checkParameter("source offer is mandatory.", offerSyncRequest.getSourceOffer());
        ParametersChecker.checkParameter("target offer is mandatory.", offerSyncRequest.getTargetOffer());
        if (offerSyncRequest.getSourceOffer().equals(offerSyncRequest.getTargetOffer())) {
            throw new IllegalArgumentException("Source offer cannot be the same as target offer");
        }
        ParametersChecker.checkParameter("strategyId is mandatory.", offerSyncRequest.getStrategyId());
        ParametersChecker.checkParameter("tenantId is mandatory.", offerSyncRequest.getTenantId());
        ParametersChecker.checkParameter("container is mandatory.", offerSyncRequest.getContainer());

        if (!VitamConfiguration.getTenants().contains(offerSyncRequest.getTenantId())) {
            throw new IllegalArgumentException("Invalid tenant " + offerSyncRequest.getTenantId());
        }
        VitamThreadUtils.getVitamSession().setTenantId(offerSyncRequest.getTenantId());
        VitamThreadUtils.getVitamSession()
            .setRequestId(GUIDFactory.newRequestIdGUID(offerSyncRequest.getTenantId()));

        DataCategory dataCategory = DataCategory.getByCollectionName(offerSyncRequest.getContainer());

        LOGGER.info(String.format("Starting %s offer synchronization from the %s source offer with %d%n offset.",
            offerSyncRequest.getTargetOffer(), offerSyncRequest.getSourceOffer(),
            offerSyncRequest.getOffset()));

        boolean started = offerSyncService
            .startSynchronization(offerSyncRequest.getSourceOffer(), offerSyncRequest.getTargetOffer(),
                offerSyncRequest.getStrategyId(), dataCategory,
                offerSyncRequest.getOffset());

        Response.Status status;
        if (started) {
            LOGGER.info("Offer synchronization started");
            status = Response.Status.OK;
        } else {
            LOGGER.warn("Another synchronization process is already running");
            status = Response.Status.CONFLICT;
        }
        return Response.status(status)
            .header(X_REQUEST_ID, VitamThreadUtils.getVitamSession().getRequestId())
            .build();
    }

    public  AdminOfferSyncResource(StorageDistribution distribution, StorageConfiguration storageConfiguration);
    @VisibleForTesting public  AdminOfferSyncResource(
        OfferSyncService offerSyncService);

}