package com.caliverse.admin.domain.api;

import com.caliverse.admin.domain.request.BattleEventRequest;
import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.domain.response.BattleEventResponse;
import com.caliverse.admin.domain.service.BattleEventService;
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/battle")
public class BattleController {
    private final BattleEventService battleEventService;
    @GetMapping("/event/list")
    public ResponseEntity<BattleEventResponse> getBattleEventList(
            @RequestParam Map<String, String> requestParam){
        return ResponseEntity.ok().body( battleEventService.getBattleEventList(requestParam));
    }

    @GetMapping("/event/detail/{id}")
    public ResponseEntity<BattleEventResponse> getBattleEventDetail(
            @PathVariable("id") Long id){
        return ResponseEntity.ok().body( battleEventService.getBattleEventDetail(id));
    }
    
    @GetMapping("/config/list")
    public ResponseEntity<BattleEventResponse> getBattleConfigList(){
        return ResponseEntity.ok().body( battleEventService.getBattleConfigList());
    }
    
    @GetMapping("/reward/list")
    public ResponseEntity<BattleEventResponse> getBattleRewardList(){
        return ResponseEntity.ok().body( battleEventService.getBattleRewardList());
    }
    
    @PostMapping("/event")
    public ResponseEntity<BattleEventResponse> postBattleEvent(
            @RequestBody BattleEventRequest battleEventRequest){

        return ResponseEntity.ok().body(battleEventService.postBattleEvent(battleEventRequest));
    }
    
    @PutMapping("/event/{id}")
    public ResponseEntity<BattleEventResponse> updateBattleEvent(
            @PathVariable("id")Long id, @RequestBody BattleEventRequest battleEventRequest){

        return ResponseEntity.ok().body(battleEventService.updateBattleEvent(id, battleEventRequest));
    }

    @PutMapping("/event/stop/{id}")
    public ResponseEntity<BattleEventResponse> updateStopBattleEvent(
            @PathVariable("id")Long id){

        return ResponseEntity.ok().body(battleEventService.updateStopBattleEvent(id));
    }
    
    @DeleteMapping("/event/delete")
    public ResponseEntity<BattleEventResponse> deleteBattleEvent(
            @RequestBody BattleEventRequest battleEventRequest){

        return ResponseEntity.ok().body(battleEventService.deleteBattleEvent(battleEventRequest));
    }
}
