package com.bizzan.bitrade.dao;

import com.bizzan.bitrade.entity.MemberAnnouncementRead;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MemberAnnouncementReadDao extends JpaRepository<MemberAnnouncementRead, Long> {

    boolean existsByMemberIdAndAnnouncementId(Long memberId, Long announcementId);

    @Query("SELECT r.announcementId FROM MemberAnnouncementRead r WHERE r.memberId = :memberId")
    List<Long> findReadIdsByMemberId(@Param("memberId") Long memberId);
}
