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

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

import java.util.List;

@Service
@AllArgsConstructor
public class EmissaoCprService {

    private final EmissaoCprRepository repository;

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

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

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