package it.integry.integrywmsnative.core.mapper;

import com.annimon.stream.Stream;

import java.util.List;

import it.integry.integrywmsnative.core.data_store.db.entity.BaseRoomDTO;
import it.integry.integrywmsnative.core.model.BaseRestDTO;

public abstract class BaseMapper<T extends BaseRestDTO, U extends BaseRoomDTO> {

    public List<U> mapRestsToRooms(List<T> inputRestList) {
        if(inputRestList == null) return null;

        return Stream.of(inputRestList)
                .map(this::mapRestToRoom)
                .toList();
    }

    public abstract U mapRestToRoom(T inputData);


    public List<T> mapRoomsToRests(List<U> inputRoomList) {
        if(inputRoomList == null) return null;

        return Stream.of(inputRoomList)
                .map(this::mapRoomToRest)
                .toList();
    }

    public abstract T mapRoomToRest(U inputData);

}
