package com.iqser.red.service.persistence.management.v1.processor.migration.migrations;

import org.springframework.stereotype.Service;

import com.iqser.red.service.persistence.management.v1.processor.migration.Migration;
import com.iqser.red.service.persistence.management.v1.processor.migration.StorageToMongoCopyService;

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Setter
@Service
public class V18StorageToMongoMigration extends Migration {

    private final StorageToMongoCopyService storageToMongoCopyService;

    private static final String NAME = "Migration for entity log storage from s3 to mongodb";
    private static final long VERSION = 18;


    public V18StorageToMongoMigration(StorageToMongoCopyService storageToMongoCopyService) {

        super(NAME, VERSION);
        this.storageToMongoCopyService = storageToMongoCopyService;
    }


    @Override
    protected void migrate() {

        log.info("Migration: Copying all files for all dossiers to mongodb");
        storageToMongoCopyService.copyEntityLogs();

    }

}
