package com.iqser.red.service.persistence.management.v1.processor.utils;

import java.util.function.BiConsumer;

import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ManualRedactionEntryEntity;
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.Rectangle;
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.ManualRedactionEntry;
import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverter;

public class ManualRedactionMapper implements BiConsumer<ManualRedactionEntryEntity, ManualRedactionEntry> {

    @Override
    public void accept(ManualRedactionEntryEntity manualRedactionEntryEntity, ManualRedactionEntry manualRedactionEntry) {

        manualRedactionEntry.setType(manualRedactionEntryEntity.getTypeId().substring(0, manualRedactionEntryEntity.getTypeId().indexOf(":")));
        manualRedactionEntry.setPositions(MagicConverter.convert(manualRedactionEntryEntity.getPositions(), Rectangle.class));
    }

}
