package com.caliverse.admin.domain.api;

import com.caliverse.admin.domain.request.EventRequest;
import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.domain.response.EventResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import com.caliverse.admin.domain.response.LandResponse;
import com.caliverse.admin.domain.service.LandService;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;

import java.util.Map;

@Tag(name = "랜드 정보 조회", description = "랜드 정보 조회 api")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/land")
public class LandController {
    private final LandService landService;

    @GetMapping("/info")
    public ResponseEntity<LandResponse> getLandInfoList(
            @RequestParam Map<String, String> requestParam){
        return ResponseEntity.ok().body( landService.getLandInfo(requestParam));
    }
    @GetMapping("/auction/list")
    public ResponseEntity<LandResponse> getLandAuctionList(
            @RequestParam Map<String, String> requestParam){
        return ResponseEntity.ok().body( landService.getLandAuctionList(requestParam));
    }
    @GetMapping("/list")
    public ResponseEntity<LandResponse> getList(){
        return ResponseEntity.ok().body( landService.getLandList());
    }
    @GetMapping("/building/list")
    public ResponseEntity<LandResponse> getBuildingList(){
        return ResponseEntity.ok().body( landService.getBuildingList());
    }
    @GetMapping("/detail/{id}")
    public ResponseEntity<LandResponse> getLandDetail(
            @PathVariable("id") Long id){
        return ResponseEntity.ok().body( landService.getLandDetail(id));
    }
    @GetMapping("/auction/detail/{id}")
    public ResponseEntity<LandResponse> getLandAuctionDetail(
            @PathVariable("id") Long id){
        return ResponseEntity.ok().body( landService.getLandAuctionDetail(id));
    }
    @PostMapping("/auction")
    public ResponseEntity<LandResponse> postLandAuction(
            @RequestBody LandRequest landRequest){

        return ResponseEntity.ok().body(landService.postLandAuction(landRequest));
    }
    @PostMapping("/change")
    public ResponseEntity<LandResponse> postLandOwnerChanges(
            @RequestBody LandRequest landRequest){

        return ResponseEntity.ok().body(landService.postLandOwnerChanges(landRequest));
    }
    @PutMapping("/auction/{id}")
    public ResponseEntity<LandResponse> updateLandAuction(
            @PathVariable("id")Long id, @RequestBody LandRequest landRequest){

        return ResponseEntity.ok().body(landService.updateLandAuction(id, landRequest));
    }
    @PutMapping("/change/{id}")
    public ResponseEntity<LandResponse> updateLandOwnerChanges(
            @PathVariable("id")Long id, @RequestBody LandRequest landRequest){

        return ResponseEntity.ok().body(landService.updateLandOwnerChanges(id, landRequest));
    }
    @DeleteMapping("/auction/delete")
    public ResponseEntity<LandResponse> deleteLandAuction(
            @RequestBody LandRequest landRequest){

        return ResponseEntity.ok().body(landService.deleteLandAuction(landRequest));
    }
    @DeleteMapping("/change/delete")
    public ResponseEntity<LandResponse> deleteLandOwnerChanges(
            @RequestBody LandRequest landRequest){

        return ResponseEntity.ok().body(landService.deleteLandOwnerChanges(landRequest));
    }
}
