package com.sc.sicanet.migracion_sicanet.service.catalogos;

import com.sc.sicanet.migracion_sicanet.DTO.catalogos.CatDestinosDTO;
import com.sc.sicanet.migracion_sicanet.repository.CatDestinosRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class CatDestinosServiceImpl implements CatDestinosService{
    @Autowired
    private CatDestinosRepository catDestinosRepository;

    @Override
    public List<CatDestinosDTO> findDestino() {
        return catDestinosRepository.findDestinoByEstatus("A")
            .stream()
            .map(catDestinosDTO -> new CatDestinosDTO(
                catDestinosDTO.getPkCatDestino(),
                catDestinosDTO.getDestino()
            )).collect(Collectors.toList());
    }
}
