package com.samsung.batch.dao;

import com.samsung.batch.entity.UserSync;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class UserSyncDao {

    private final SqlSession sqlSession;

    public UserSyncDao(SqlSession sqlSession) {
        this.sqlSession = sqlSession;
    }

    public List<UserSync> getUserSyncList() {
        return sqlSession.selectList("selectAllUserSyncList");
    }

    public void insertUserSync(UserSync userSync) {
        sqlSession.insert("insertUserSync", userSync);
    }

    public void updateUserSync(UserSync userSync) {
        sqlSession.update("updateUserSync", userSync);
    }

    public void deleteUserSync(String userId) {
        sqlSession.delete("deleteUserSync", Map.of("userId", userId));
    }
}