package com.pandoli365.bibimbap.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface JamTeamMembersMapper {

    @Insert("""
            INSERT INTO jam_team_members (
                jam_team_id,
                user_id
            ) VALUES (
                #{jamTeamId},
                #{userId}
            )
            """)
    int insert(@Param("jamTeamId") long jamTeamId, @Param("userId") long userId);

    @Select("""
            SELECT EXISTS(
                SELECT 1
                FROM jam_team_members
                WHERE jam_team_id = #{jamTeamId}
                  AND user_id = #{userId}
            )
            """)
    boolean exists(@Param("jamTeamId") long jamTeamId, @Param("userId") long userId);
}
