package ru.vyatsu.qr_access_admin.unit.mapper;

import ru.vyatsu.qr_access_admin.unit.model.UnitComboBoxModel;
import ru.vyatsu.qr_access_admin.unit.entity.UnitEntity;

import java.util.Collection;
import java.util.List;

public class UnitEntityUnitComboBoxModelMapper {

    public UnitComboBoxModel toModel(UnitEntity entity) {
        if (entity == null) {
            throw new IllegalArgumentException("UnitEntity cannot be null");
        }
        return new UnitComboBoxModel(entity.getClientId(), entity.getClientName());
    }

    public List<UnitComboBoxModel> toModels(Collection<UnitEntity> entities) {
        return entities.stream()
                .map(this::toModel)
                .toList();
    }
}
