package com.lion.lionwebsite.Controller;

import com.lion.lionwebsite.Service.UserServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/personal/user")
public class UserController {
    UserServiceImpl userService;

    public UserController(UserServiceImpl userService) {
        this.userService = userService;
    }

    @GetMapping("")
    public String getAllUser(){
        return userService.getAllUser();
    }

    @PostMapping("")
    public String addAuthCode(String targetAuthCode, String username){
        return userService.addAuthCode(targetAuthCode, username);
    }

    @PutMapping("/AuthCode")
    public String alterAuthCode(String targetAuthCode, String newAuthCode){
        return userService.alterAuthCode(targetAuthCode, newAuthCode);
    }

    @PutMapping("/Username")
    public String alterUsername(String targetAuthCode, String newUsername){
        return userService.alterUsername(targetAuthCode, newUsername);
    }

    @DeleteMapping ("")
    public String deleteAuthCode(String targetAuthCode){
        return userService.deleteAuthCode(targetAuthCode);
    }

    @PutMapping("/status")
    public String alterStatus(String AuthCode, boolean isEnable){
        return userService.alterStatus(AuthCode, isEnable);
    }
}
