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.RankDeDuplicationService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
public class V32RankDeduplicationMigration extends Migration {

    private static final String NAME = "Adding to the migration the rank de-duplication";
    private static final long VERSION = 32;

    private final RankDeDuplicationService rankDeDuplicationService;


    public V32RankDeduplicationMigration(RankDeDuplicationService rankDeDuplicationService) {

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


    @Override
    protected void migrate() {

        log.info("Migration: Checking for duplicate ranks");
        rankDeDuplicationService.deduplicate();

    }

}
