package com.caliverse.admin.domain.api;

import com.caliverse.admin.domain.request.MailRequest;
import com.caliverse.admin.domain.request.UsersRequest;
import com.caliverse.admin.domain.response.MailResponse;
import com.caliverse.admin.domain.response.UsersResponse;
import com.caliverse.admin.domain.service.UsersService;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Tag(name = "유저조회", description = "유저조회 api")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/users")
public class UsersController {
    private final UsersService usersService;

    @PutMapping("/change-nickname")
    public ResponseEntity<UsersResponse> changeNickname(
            @RequestBody UsersRequest requestBody){
        return ResponseEntity.ok().body( usersService.changeNickname(requestBody));
    }
    @PutMapping("/change-level")
    public ResponseEntity<UsersResponse> changeAdminLevel(
            @RequestBody UsersRequest requestBody){
        return ResponseEntity.ok().body( usersService.changeAdminLevel(requestBody));
    }
    @GetMapping("/find-users")
    public ResponseEntity<UsersResponse> findUsers(
            @RequestParam Map<String, String> requestParams){
        return ResponseEntity.ok().body( usersService.findUsers(requestParams));
    }
    @GetMapping("/basicinfo")
    public ResponseEntity<UsersResponse> getUsersInfo(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getBasicInfo(guid));
    }
    @GetMapping("/avatarinfo")
    public ResponseEntity<UsersResponse> getAvatarInfo(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getAvatarInfo(guid));
    }
    @GetMapping("/clothinfo")
    public ResponseEntity<UsersResponse> getClothInfo(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getClothInfo(guid));
    }
    @GetMapping("/toolslot")
    public ResponseEntity<UsersResponse> getSlotInfo(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getToolSlotInfo(guid));
    }
    @GetMapping("/inventory")
    public ResponseEntity<UsersResponse> getInventoryInfo(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getInventoryInfo(guid));
    }
    @DeleteMapping("/inventory/delete/item")
    public ResponseEntity<UsersResponse> deleteInventoryItem(
            @RequestBody Map<String, String> requestParams){

        return ResponseEntity.ok().body(usersService.deleteInventoryItem(requestParams));
    }
    //todo
    @GetMapping("/mail")
    public ResponseEntity<UsersResponse> getMail(
            @RequestParam("guid") String guid, @RequestParam("type") String type){
        return ResponseEntity.ok().body( usersService.getMail(guid,type));
    }
    @DeleteMapping("/mail/delete")
    public ResponseEntity<UsersResponse> deleteMail(
            @RequestBody Map<String, String> requestParams){

        return ResponseEntity.ok().body(usersService.deleteMail(requestParams));
    }
    @DeleteMapping("/mail/delete/item")
    public ResponseEntity<UsersResponse> deleteMailItem(
            @RequestBody MailRequest.DeleteMailItem requestParams){

        return ResponseEntity.ok().body(usersService.deleteMailItem(requestParams));
    }
    @GetMapping("/myhome")
    public ResponseEntity<UsersResponse> getMyhome(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getMyhome(guid));
    }
    //todo
    @GetMapping("/friendlist")
    public ResponseEntity<UsersResponse> getFriendList(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getFriendList(guid));
    }
    //todo
    @GetMapping("/tattoo")
    public ResponseEntity<UsersResponse> getTattoo(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getTattoo(guid));
    }
    //todo
    @GetMapping("/quest")
    public ResponseEntity<UsersResponse> getQuest(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getQuest(guid));
    }
    //todo
    /*@GetMapping("/claim")
    public ResponseEntity<UsersResponse> getClaim(
            @RequestParam("guid") String guid){
        return ResponseEntity.ok().body( usersService.getClaim(guid));
    }*/
}
