package com.bsis.peuplement.service;

import com.bsis.peuplement.model.Dossier;
import com.bsis.peuplement.model.Redevable;
import com.bsis.peuplement.repository.RedevableRepository;
import com.bsis.peuplement.tasks.Tasks;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;
import java.util.Optional;

@Service
public class RedevableService {
    @Autowired
    private RedevableRepository redevableRepository;
    //...................................................................
    //                              Read
    //...................................................................
    public List<Redevable> getAll()
    {
        return redevableRepository.findAll();
    }
    //................................
    public Optional<Redevable> getById(Long id)
    {
        return  redevableRepository.findById(id);
    }
    //...................................................................
    public long count() {
        return redevableRepository.count();
    }
    //...................................................................
    //                            Update
    //...................................................................
    public Redevable update(Redevable redevable){
        return	redevableRepository.save(redevable);
    }

}
