package de.cannamanage.service.repository;

import de.cannamanage.domain.entity.DeviceToken;
import de.cannamanage.domain.enums.DevicePlatform;
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 DeviceTokenRepository extends JpaRepository<DeviceToken, UUID> {

    List<DeviceToken> findByUserId(UUID userId);

    List<DeviceToken> findByUserIdAndPlatform(UUID userId, DevicePlatform platform);

    List<DeviceToken> findByUserIdAndPlatformIn(UUID userId, List<DevicePlatform> platforms);

    Optional<DeviceToken> findByUserIdAndToken(UUID userId, String token);

    long countByUserId(UUID userId);

    void deleteByToken(String token);
}
