package com.handong.smartservice.service;

import com.handong.smartservice.mapper.AccountMapper;
import org.springframework.security.core.userdetails.*;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class CustomUserDetailsService implements UserDetailsService {

    private final AccountMapper accountMapper;

    public CustomUserDetailsService(AccountMapper accountMapper) {
        this.accountMapper = accountMapper;
    }

    
    @Override
    public UserDetails loadUserByUsername(String userId) throws UsernameNotFoundException {
        /*
        var account = accountMapper.selectById(userId);
        if (account == null) {
            throw new UsernameNotFoundException("error");
        }


        return new User(
                (String) account.get("user_id"),
                (String) account.get("user_pw"),
                List.of() // 권한이 없으면 빈 리스트
        );
        */
       return new User(
                "user_id",
                "user_pw",
                List.of() // 권한이 없으면 빈 리스트
        );
    }
    
}
