package com.platform2easy.genesis.domain.service.cerc;

import com.platform2easy.genesis.domain.model.cerc.ContratoValorCpr;
import com.platform2easy.genesis.domain.model.cerc.SolicitacaoRegistroCpr;
import com.platform2easy.genesis.domain.repository.cerc.ContratoValorCprRepository;
import jakarta.transaction.Transactional;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@AllArgsConstructor
public class ContratoValorCprService {

    private final ContratoValorCprRepository repository;

    @Transactional
    public void save(ContratoValorCpr entity) {
        repository.save(entity);
    }
    public ContratoValorCpr getById(Long id) {
        return repository.findById(id).orElse(new ContratoValorCpr());
    }

    public void delete(Long id) {
        repository.deleteById(id);
    }

    public List<ContratoValorCpr> listAll() {
        return repository.findAll();
    }

}
