package com.gnx.telemedicine.repository;

import com.gnx.telemedicine.model.DataSubjectConsent;
import com.gnx.telemedicine.model.UserModel;
import com.gnx.telemedicine.model.enums.ConsentStatus;
import com.gnx.telemedicine.model.enums.ConsentType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

@Repository
public interface DataSubjectConsentRepository extends JpaRepository<DataSubjectConsent, UUID> {
    Optional<DataSubjectConsent> findByUserAndConsentType(UserModel user, ConsentType consentType);
    
    List<DataSubjectConsent> findByUser(UserModel user);
    
    List<DataSubjectConsent> findByUserAndConsentStatus(UserModel user, ConsentStatus status);
    
    boolean existsByUserAndConsentTypeAndConsentStatus(UserModel user, ConsentType consentType, ConsentStatus status);
}

