package com.MedInsuranceV2.Version20.Enquiry;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service // This annotation marks the class as a Spring service component
public class EnquiryService {

    @Autowired // Injects the EnquiryRepository
    private EnquiryRepository enquiryRepository;

    public Enquiry saveEnquiry(Enquiry enquiry) {
        return enquiryRepository.save(enquiry); // Saves the enquiry to the database
    }

    public List<Enquiry> getAllEnquiries() {
        return enquiryRepository.findAll(); // Retrieves all enquiries
    }

    // You can add more business logic here, e.g., getEnquiryById, deleteEnquiry etc.
}
