package de.cannamanage.service.repository;

import de.cannamanage.domain.entity.Consent;
import de.cannamanage.domain.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 ConsentRepository extends JpaRepository<Consent, UUID> {

    Optional<Consent> findByUserIdAndConsentType(UUID userId, ConsentType consentType);

    List<Consent> findByUserId(UUID userId);

    List<Consent> findByUserIdAndGrantedTrue(UUID userId);

    boolean existsByUserIdAndConsentTypeAndGrantedTrue(UUID userId, ConsentType consentType);
}
